How to fix "Compile error" displays, "Variable not defined"

Unicode

Board Regular
Joined
Apr 9, 2019
Messages
58
Question for you. Sheet 1&2 name titles need to be changed with the following titles: Sheet1= PrePaidReport, Sheet2 = NewFormat, after I made the changes inthe VBA Script, Sheet titles change to capital letters, then I get, "Compile error" displays, "Variable not defined".
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Are you trying to change the tab name of the worksheet whose codename is Sheet1?
If so the sytnax for that is

Code:
Sheet1.Name = "PrePaidReport"
 
Upvote 0
Hi there, thank you for the message follow up, I believe all has been fixed and we can close this one. I added the following and all appears to work. However, I might need something additional for these sheets, I will follow up with you and all details. ADDED: "Dim sht As Worksheet"




Are you trying to change the tab name of the worksheet whose codename is Sheet1?
If so the sytnax for that is

Code:
Sheet1.Name = "PrePaidReport"
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top