D
Dan R.
I'm looping through some workbooks in a directory, then adding new
sheets to my active workbook. How can I test to make sure a worksheet
doesnt exist before I add it? And if it does exist how do I activate
that sheet? Something like this maybe?
If ThisWorkbook.Worksheets <> Left$(bk.Name, 3) Then
Set sh2 = ThisWorkbook.Worksheets.Add
sh2.Name = Left$(bk.Name, 3)
' Do stuff with sh2
Else
Set sh2 = Left$(bk.Name, 3)
' Do stuff with sh2
End If
Thanks,
-- Dan
sheets to my active workbook. How can I test to make sure a worksheet
doesnt exist before I add it? And if it does exist how do I activate
that sheet? Something like this maybe?
If ThisWorkbook.Worksheets <> Left$(bk.Name, 3) Then
Set sh2 = ThisWorkbook.Worksheets.Add
sh2.Name = Left$(bk.Name, 3)
' Do stuff with sh2
Else
Set sh2 = Left$(bk.Name, 3)
' Do stuff with sh2
End If
Thanks,
-- Dan