Hi Excel Masters,
I am working with a spreadsheet that does a data dump every month that is really messy, I'm trying to automate as much of the cleanup as possible.
The only thing I'm stuck on with the VBA code is how to delete visible rows instead of specific rows as the number of rows with data will change from month to month.
Any help would be much appreciated.
I am working with a spreadsheet that does a data dump every month that is really messy, I'm trying to automate as much of the cleanup as possible.
The only thing I'm stuck on with the VBA code is how to delete visible rows instead of specific rows as the number of rows with data will change from month to month.
Any help would be much appreciated.
Code:
Sub Delete_Visible_Rows
'
'
Cells.Select
Selection.AutoFilter
Range("A3").Select
ActiveSheet.Range("$A$1:$J$2373").AutoFilter Field:=1, Criteria1:=Array( _
"------------------*" _
, _
"- - *" _
, _
"========*" _
, _
"=======*" _
, _
"ACCNT*" _
, "C CTR*", "COMPANY", "PROD PROJ"), Operator _
:=xlFilterValues
Rows("5:2371").Select
Selection.Delete Shift:=xlUp
ActiveSheet.ShowAllData
Range("A1").Select
End Sub
Code:
Sub Highlight_Visible_Rows()
'
Cells.Select
Selection.AutoFilter
Range("A3").Select
ActiveSheet.Range("$A$1:$J$3000").AutoFilter Field:=2, Criteria1:="=ATT :" _
, Operator:=xlOr, Criteria2:="=CA"
Rows("6:1857").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 10498160
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.ShowAllData
Range("A1").Select
End Sub
Last edited: