I have this at the very beginning of my code:
I am doing this to remove subtotals and clear the sheet before the rest of the code runs which will populate the sheet and create Subtotals.
The problem is, when the code is run the first time, the sheet is blank. But this code may be run a number of times after additional input is entered.
If the sheet has info and Subtotals, it works fine, it's just on the first run that it errors out. (understandable, no data)
I know I need an error trap, but don't know how to apply it. Looked at about 50 posts on Search , can't find anything related.
Thanks
Harry
Code:
With ws2.UsedRange
.RemoveSubtotal
.Cells.Clear
I am doing this to remove subtotals and clear the sheet before the rest of the code runs which will populate the sheet and create Subtotals.
The problem is, when the code is run the first time, the sheet is blank. But this code may be run a number of times after additional input is entered.
If the sheet has info and Subtotals, it works fine, it's just on the first run that it errors out. (understandable, no data)
I know I need an error trap, but don't know how to apply it. Looked at about 50 posts on Search , can't find anything related.
Thanks
Harry