What I have is quite a complicated Macro that I'm building in VBA in Excel. The idea is that I have a range of 'Client Numbers' that I have used in a loop to create specific output in the form of pivot tables. The loop then goes on to create final 'Output' tabs, where the data from the pivot tables are pasted.
This is dynamic, meaning that the client numbers will change from user to user. I have managed to get the meat of the macro sorted, but what I am having a problem with is selecting the correct output tab.
I declared the variable as such:
ClientNum As Range
And have used this to create and name the new tabs as such... (this is just a snippet!)
If Not SheetExists(ClientNum.Value) Then Sheets("OP Template").Select Sheets("OP Template").Copy After:=Sheets("OP Template") Sheets("OP Template (2)").Select ActiveSheet.Name = ClientNum.Value End If
My current line of thinking is to use something similar to select the correct output tab later in the code:
But this is where the whole thing trips up.... Is there another way of doing this?