sweeneytime
Board Regular
- Joined
- Aug 23, 2010
- Messages
- 183
Hi all,
Trying to group sheets with a macro.
I was using an array with the sheet names defined. But I want the code to be able to select new sheets if added. Selecting sheets based on data in "A5".
I adapted code that looped and selected sheets correctly. But it won't group, just selects each sheet individually and moves on.
Any suggestions?
Thanks,
Alan
Trying to group sheets with a macro.
I was using an array with the sheet names defined. But I want the code to be able to select new sheets if added. Selecting sheets based on data in "A5".
I adapted code that looped and selected sheets correctly. But it won't group, just selects each sheet individually and moves on.
Any suggestions?
Thanks,
Alan
PHP:
Sub SelectCC()
Dim ws As Worksheet
'Select sheets with "INCOME" in A5
'Should only be the Cost Centres
For Each ws In ActiveWorkbook.Worksheets
If ws.Range("A5").Text = ("INCOME") Then
ws.Select
End If
Next ws
End Sub