renaming back the sheet index of a worksheet while retaining its original name

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
I came across an article that prevent a worksheet from being deleted without using sheet protect. IN THE WORKSHEET BEFORE DELETE SUB> it copied & renamed the sheet - and after the orig sheet was deleted - it renamed back the orig name (nice trick)... but the sheet index is now different... my query is how to rename back the sheet index and still retain the worksheet name

example - original sheet index= sheet20; sheet name = "Entry Form"
assuming the workbook's last index = sheet32
after the process> the new sheet index will be sheet33 sheet name (still) = "Entry Form"
the sheet20 will be gone from the list
How could I change it back to sheet20>"Entry Form"

Many Thanks
 
Mr Fluff

btw, what does the following do? could it be detrimental to my work or computer (sorry for my ignorance)?

BUT for this to work you will have to goto > File > Options > Trust Center > Trust Center settings > Macro Settings > Select "Trust access to the VBA project object model"

Thank you for your time
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Mr Fluff

sorry I did not check the trust option box.
now it is working fine!

isn't there a way for VBA to make the setting then return it back to the default?

THANK YOU VERY VERY MUCH FOR YOUR TIME AND ASSISTANCE
 
Upvote 0
could it be detrimental to my work or computer (sorry for my ignorance)?
YES, it could! It enables macros to make changes to (and write) other macros.
 
Upvote 0
isn't there a way for VBA to make the setting then return it back to the default?
Not that I know of.
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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