RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 801
- Office Version
- 365
- Platform
- Windows
Hi all,
Have a sheet I'm filtering and copying the visible cells in this Macro, but in some rare circumstances, once the filter is applied, there are no visible cells.
The intention is, if there are visible cells to copy them and then start playing with them, but if there aren't, go to Skip, drop down a line and re-run through the loop.
However, on this particular piece of code being looped, the filters result in no visible cells and I get "Run-time error '1004': No cells were found."
So that's an error, but it's not skipping? Any ideas why? Thanks.
Have a sheet I'm filtering and copying the visible cells in this Macro, but in some rare circumstances, once the filter is applied, there are no visible cells.
Code:
On Error GoTo SkipTourCopyRng.SpecialCells(xlCellTypeVisible).Copy temp.Range("A12")
NameCopyRng.SpecialCells(xlCellTypeVisible).Copy temp.Range("B12")
DateCopyRng.SpecialCells(xlCellTypeVisible).Copy temp.Range("C12")
CostCopyRng.SpecialCells(xlCellTypeVisible).Copy temp.Range("D12")
ad.Close False
[extra code for when there are cells]
Skip:
ads.Activate
ActiveCell.Offset(1, 0).Activate
The intention is, if there are visible cells to copy them and then start playing with them, but if there aren't, go to Skip, drop down a line and re-run through the loop.
However, on this particular piece of code being looped, the filters result in no visible cells and I get "Run-time error '1004': No cells were found."
So that's an error, but it's not skipping? Any ideas why? Thanks.