xl-vba: Copy hidden sheet and manipulate it

lalbatros

Well-known Member
Joined
Sep 5, 2007
Messages
659
Hello,

I want to copy a hidden template sheet, using VBA.
I do not want to make this template visible before I finish making some modifications to it like: naming it and writing a few things onto it.

I was unable to do that.
This is simply because I cannot Get the sheet to make these modifications.

The copied sheet doesn't become active since it is hidden.
The name of the hidden sheet is not easily predictable.
The Copy method does not return a sheet object, unfortunately.

How would you proceed to get the copy?

Thanks,

Michel
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Michel

If you copy the sheet and use the Before argument then you can be sure the copied sheet will be returned to index 1 in the workbook, then you know where the sheet is:

Code:
Sheets(Sheets.Count).Copy Before:=Sheets(1)   'copying the last sheet in the workbook - amend as appropriate

Msgbox "Copied sheet's name is " & Sheets(1).Name
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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