View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Adding new sheet problem-Macro

one way:

With Worksheets.Add
On Error Resume Next 'in case M1 exists
.Name = "M1"
On Error GoTo 0
End With

In article ,
pikapika13
wrote:

I'm very new to this. I'm trying to open a new worksheet and call it a
name.
However, I never know what sheet name excel is going to give me:
sometimes "Sheet1" or "Sheet10". It depends on how many times I run
the macro.
Is there a way to convert this:
' Workbooks.Add
Sheets("Sheet1").Name = "M1"

to something more friendly?