I am using the following VBA to add a new worksheet but occasionally receive the '1004' run-time error "That command cannot be used in multiple selections"
Although I thought I broadly understood the nature of this error message, I am struggling to find where the multiple selections might be. Is there some command I can put before "Worksheet.Add" to guarantee that multiple selections are not occurring and therefore prevent the run-time error?PHP Code:
Worksheets.Add(Before:=Worksheets("SheetA")).Name = "SheetB"
I've tried
andPHP Code:
Worksheets("SheetA").Activate
But these do not seem to handle it.PHP Code:
Worksheets(("SheetA").Visible = xlSheetVisible
Sheets(("SheetA").Select
Thanks in advance.
Bookmarks