Selecting mulitple worksheets to Print (using VBA)
No. Instead of concatenating the sheet names, you need to put them into an
array. If you show the code where you build your string, perhaps it can be
modified to build an array.
This is a kludgy workarouand, but it will be limited in the number of sheet
names you can handle and is not recommended. Better to build the array the
right way.
Sub Testme()
myString = """Sheet1""," & """Sheet2""," & """Sheet3"""
myString = "{" & myString & "}"
varr = Evaluate(myString)
Worksheets(varr).Select
End Sub
--
Regards,
Tom Ogilvy
"Adele" wrote in message
...
I need to select a user defined list of worksheets all at once using VBA.
I have a string variable containing a list of selected worksheets.
for example: mystring = "Sheet1,"&"Sheet2,"&"Sheet3"
Is it possible to pass the variable mystring as an argument in the
following
function:
Sheets(Array(mystring)).Select without it generating an error message ?
Or is there another way of selecting worksheets at once using VBA ?
|