G
Guest
Hi everyone,
You guys have been so helpful, I can't help but ask you again to help me
with a problem I can't seem to get around.
I wanna check if a worksheet exists before creating a new worksheet. I
stole bits from other questions on this forum, and came up with :
Workbooks(tata).Activate
Set sh = Worksheets(toto)
On Error Resume Next
If sh Is Nothing Then
Worksheets.Add.Name = Worksheets(toto)
Else
sh.Activate
End If
my strings "tata" and "toto" work fine elsewhere, but I gather that I get a
"Subscript out of range" at the line : "Set sh = Worksheets(toto)"
because worksheet "toto" doesn't exist.....but that's the purpose of this
thing, to check if it exists.
Yeah, I know I should also get help to find better variable names
Thanks in advance for your help
Marc
You guys have been so helpful, I can't help but ask you again to help me
with a problem I can't seem to get around.
I wanna check if a worksheet exists before creating a new worksheet. I
stole bits from other questions on this forum, and came up with :
Workbooks(tata).Activate
Set sh = Worksheets(toto)
On Error Resume Next
If sh Is Nothing Then
Worksheets.Add.Name = Worksheets(toto)
Else
sh.Activate
End If
my strings "tata" and "toto" work fine elsewhere, but I gather that I get a
"Subscript out of range" at the line : "Set sh = Worksheets(toto)"
because worksheet "toto" doesn't exist.....but that's the purpose of this
thing, to check if it exists.
Yeah, I know I should also get help to find better variable names
Thanks in advance for your help
Marc