Inserting a sheet with a macro

  • Thread starter Thread starter Bowly
  • Start date Start date
B

Bowly

Hi

I'm just getting into this VBA lark with Excel and have come across a
problem! :confused:

I'm used to creating macros by pressing the little record button
selecting the rows and editing them as usual. I then press play and it
all happens magically in front of my eyes!

My problem, however, is how to insert a worksheet without it
automatically being named "sheet1". When this happens, I am unable to
run this macro more than once in any given session. Is there a way I
can make this sheet name generic so that when I run the macro a new
sheet will be opened whether it's called "sheet1" "sheet2" or "sheet3"
etc...

Please help!! :eek:

Cheers
Bowly
 
And you could just rename the new worksheet to what you want.

Dim newWks as worksheet
set newwks = worksheets.add
newwks.name = "niceUniqueNameHere"
 
Back
Top