Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
select/group sheets dependent on criteria
Hi all, I wonder if you could offer some advice, please.
I am generating a number of worksheets within a workbook. I then want to group some of them and copy them to another workbook. The names of the worksheets I am interested in all end in "DWM". If I manually select the sheets and record the actions, I get: Sheets(Array("Sunderland DWM", "Manchester DWM", "Coventry DWM")).Select So, I thought, I just need to loop through the sheets and build the string .... Dim ArrayList as String For Each Sheet In Sheets If Right(Sheet.Name, 3) = "DWM" And Sheet.Name < "Blank DWM" Then If ArrayList = "" Then ArrayList = """" & Sheet.Name & """" Else ArrayList = ArrayList & ", " & """" & Sheet.Name & """" End If End If Next But, when I try to select the sheets based on the string I have built up ... Sheets(Array(ArrayList)).Select .... I get Run-time error '9': Subscript out of range ArrayList contains: "Sunderland DWM", "Manchester DWM", "Coventry DWM" Any suggestions as to how to get this to work ... or offer a better way ? Thanks and Regards Trevor |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying data from one workbook to another dependent on user select | Excel Discussion (Misc queries) | |||
select dependent cells in the result cell | Excel Discussion (Misc queries) | |||
Using VBA select sll sheets based on Criteria on each sheet. | Excel Discussion (Misc queries) | |||
Multi select dependent on cell in range | Excel Programming |