Forum

Need help with stat...
 
Notifications
Clear all

Need help with static worksheet in excel VBA

2 Posts
2 Users
0 Reactions
144 Views
 M M
(@great)
Posts: 6
Active Member
Topic starter
 

i have sheet1 and sheet2 (sheet 2 i renamed it as  sheet_report).

i have some data coming to sheet2 from other work book when i run a macro. it was working fine but i have a issue. when some deletes the sheet2(sheet_report) and recreates it ,it is creating as sheet3 and when sheet3 is deleted the new one created is sheet4.so my macro couldn't find the sheet2 to fill the data.

is there any way we can do any thing that when sheet2 is deleted and and when i create a new sheet the sheet name should be again sheet2.

 

Can any one please help on this!

Thanks in Advance

 
Posted : 16/03/2020 3:46 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi MM.

Excel uses its own internal names for the sheets e.g. Sheet1, Sheet2.  If you change the names on the sheet tabs in your workbook, these internal names stay the same.

So, just refer to the sheet by the name you use for it on the sheet tab e.g.

Worksheets("sheet_report").Activate

Regards

Phil

 
Posted : 16/03/2020 6:59 pm
Share: