I have a excel workbook which can have a different number of sheets. With a VBA program I check the the content of the sheets. For this I have to loop trough the sheets. Now I want to select multiple sheets but this can differ from run to run. als the sheet names can differ from run to run.
I know how to store the names in a matrix and I wanted to use this matrix to select multiple sheets bus this doesn't work. Can you please give me a solution. Hereunder I give a example of how I wanted to solve the problem.
Dim bladen(6) As String
Sub Macro1()
bladen(1) = "Sheet1"
bladen(2) = "Sheet2"
bladen(3) = "Sheet3"
bladen(4) = "Sheet4"
bladen(5) = "Sheet5"
bladen(6) = "Sheet6"
Sheets(Array(bladen)).Select
Sheets("Blad6").Activate
End Sub
In the program I find the names of the sheets with a for next loop so thats no problem, the problem is the selection of a unknown number of sheets.
I'm not an expert so its quit simple, thats no problem as long as it works.
thanks for your time
Leendert de Geus
I know how to store the names in a matrix and I wanted to use this matrix to select multiple sheets bus this doesn't work. Can you please give me a solution. Hereunder I give a example of how I wanted to solve the problem.
Dim bladen(6) As String
Sub Macro1()
bladen(1) = "Sheet1"
bladen(2) = "Sheet2"
bladen(3) = "Sheet3"
bladen(4) = "Sheet4"
bladen(5) = "Sheet5"
bladen(6) = "Sheet6"
Sheets(Array(bladen)).Select
Sheets("Blad6").Activate
End Sub
In the program I find the names of the sheets with a for next loop so thats no problem, the problem is the selection of a unknown number of sheets.
I'm not an expert so its quit simple, thats no problem as long as it works.
thanks for your time
Leendert de Geus