jasonkgreen
Board Regular
- Joined
- Feb 21, 2013
- Messages
- 50
I have a data set of just under 60,000 records. It starts with 103 columns. I have recorded a macro to delete 77 of these columns.
I then delete around 50k of these records based on "status_type" (not active). I'm not sure my macro for this is the most efficient. My first question: what's the best way to highlight all the visible rows so they can be deleted, cut, or copied? Below is what I have right now. My concern with the VBA code below is that if my filtered rows are 1109 thru 4574, will the code below delete only those visible rows?
'1. Apply Filter
ws.Range("A3:Z60000").AutoFilter Field:=15, Criteria1:="4"
'2. Delete Rows
Application.DisplayAlerts = False
ws.Range("A3:Z60000").SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
I then delete around 50k of these records based on "status_type" (not active). I'm not sure my macro for this is the most efficient. My first question: what's the best way to highlight all the visible rows so they can be deleted, cut, or copied? Below is what I have right now. My concern with the VBA code below is that if my filtered rows are 1109 thru 4574, will the code below delete only those visible rows?
'1. Apply Filter
ws.Range("A3:Z60000").AutoFilter Field:=15, Criteria1:="4"
'2. Delete Rows
Application.DisplayAlerts = False
ws.Range("A3:Z60000").SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True