Using VBA code for renaming the sheet

I am using VBA script for renaming the sheet after enable all the macros in
Excel Spreadsheet getting below error:

can you upload your sequence and vba file here?

PFB

Code for VBA
image

change ACCT-ID to ACCTID , you can’t have a “-” in argument name

like this

Sub ChangeSheetName(Sheet2 As String, ACCTID As String)
Sheets(Sheet2).Name = ACCTID
End Sub

Thanks you very much for the help…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.