Your technology certification is waiting. Enroll in Cloud Class ®
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Sheet" & Sheets.Count + 1
Open in new window
Your question, your audience. Choose who sees your identity—and your question—with question security.
intMax = 0
For Each sh In ActiveWorkbook.Sheets
If sh.Name Like "Sheet#*" Then
intMax = WorksheetFunction.Max(intMax, Right(sh.Name, Len(sh.Name) - 5))
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Sheet" & intMax + 1
Dim WSname As Worksheet
WSname = ActiveSheet.name
WSname.name = "By State"
ActiveWorkbook.PivotCaches.Create(SourceType:=xlExternal, SourceData:= _
ActiveWorkbook.Connections("ThisWorkbookDataModel"), Version:=6). _
CreatePivotTable TableDestination:="By State!R1C1", TableName:= _
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.