Nanogirl21
Active Member
- Joined
- Nov 19, 2013
- Messages
- 331
- Office Version
- 365
- Platform
- Windows
I am using the code to move data from 1 worksheet to another. Right now the code skips to the next worksheet if there is an error (the error is when there is no data to move).
How can I modify the code to skip to End Sub and not go to next worksheet if there is an error WITHOUT getting the error/debug pop up?
How can I modify the code to skip to End Sub and not go to next worksheet if there is an error WITHOUT getting the error/debug pop up?
Code:
Dim x As Long
Dim y As Long
Dim cell As Range
For Each ws In Worksheets
On Error Resume Next
Dim Usdrws As Long
Usdrws = Sheets("TVAE").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Sheets("TVAE").Range("A1:A" & Usdrws).SpecialCells(xlVisible).Copy
Sheets("Tracking").Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Sheets("TVAE").Range("B1:B" & Usdrws).SpecialCells(xlVisible).Copy
Sheets("Tracking").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Sheets("TVAE").Range("C1:K" & Usdrws).SpecialCells(xlVisible).Copy
Sheets("Tracking").Range("C" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Sheets("TVAE").Range("M1:O" & Usdrws).SpecialCells(xlVisible).Copy
Sheets("Tracking").Range("L" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Sheets("TVAE").Range("R1:U" & Usdrws).SpecialCells(xlVisible).Copy
Sheets("Tracking").Range("V" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
Next ws
End Sub
Last edited: