Viking1221
New Member
- Joined
- May 25, 2017
- Messages
- 32
Hello,
I have a macro that use the autofilter function to find blanks and then deletes the rows. However, I am struggling with how to write a macro that will find the last column in row 10 and filter on zero and delete all 0's. Then after it executes this code, I want 'that' entire column deleted. Any ideas?
This is the code I have, but is specifically looks at Column C:
Sub DeleteRowsC()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Journals")
ws.Activate
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
ws.Range("A10:BZ10000").AutoFilter Field:=3, Criteria1:=""
Application.DisplayAlerts = False
ws.Range("A10:BZ10000").SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
End Sub
I have a macro that use the autofilter function to find blanks and then deletes the rows. However, I am struggling with how to write a macro that will find the last column in row 10 and filter on zero and delete all 0's. Then after it executes this code, I want 'that' entire column deleted. Any ideas?
This is the code I have, but is specifically looks at Column C:
Sub DeleteRowsC()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Journals")
ws.Activate
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
ws.Range("A10:BZ10000").AutoFilter Field:=3, Criteria1:=""
Application.DisplayAlerts = False
ws.Range("A10:BZ10000").SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
End Sub