tourless
Board Regular
- Joined
- Feb 8, 2007
- Messages
- 144
- Office Version
- 365
- Platform
- Windows
Hi Folks,
I have a routine that takes a bunch of sheets in an array and performs a few actions including removing a subtotal. But what I'm noticing is if the active sheet in the loop does not have a subtotal I get 'RemoveSubtotal method of Range of class failed' error. Is it possible for first test for the existence of a subtotal and remove it only if it does exist? Here's what I'm working with... yeah I know about selecting...
Thanks.
I have a routine that takes a bunch of sheets in an array and performs a few actions including removing a subtotal. But what I'm noticing is if the active sheet in the loop does not have a subtotal I get 'RemoveSubtotal method of Range of class failed' error. Is it possible for first test for the existence of a subtotal and remove it only if it does exist? Here's what I'm working with... yeah I know about selecting...
Code:
'Remove previous results
For Each ResultsSh In Sheets(Array("HT-LB-W1V", "COG-M-LB-W1V", "COG-CMPS-LB-W1V", "Revenue", "Revenue2"))
'ResultsSh.Select
'Clear old result set from array
ResultsSh.Rows.Hidden = False
ResultsSh.Columns("A:B").Delete Shift:=xlToLeft
ResultsSh.Range("A1").RemoveSubtotal
'ResultsSh.Range("A1").Select
Next
Thanks.