L
Legacy 198477
Guest
I am trying to filter out rows where specific column data is blank. When I run the code below and there are no rows with blank data, the entire worksheet is copied. If I do have one row with blank data in the column, only that row is copied. I need to script for all scenarios, so there will be times when I have rows with no blank columns. In this case, I do not want to copy anything. Help is greatly appreciated!
Sub NoInventoryDate()
Dim Rng As Range
With Sheets("Inventoried Items")
.AutoFilterMode = False
.Range("A1").AutoFilter field:=6, Criteria1:="="
Set Rng = .AutoFilter.Range
Set Rng = Rng.Offset(1).Resize(Rng.Rows.count - 1)
Rng.Copy Sheets("Missing").Cells(Rows.count, 1).End(xlUp)(2)
Rng.EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Sub NoInventoryDate()
Dim Rng As Range
With Sheets("Inventoried Items")
.AutoFilterMode = False
.Range("A1").AutoFilter field:=6, Criteria1:="="
Set Rng = .AutoFilter.Range
Set Rng = Rng.Offset(1).Resize(Rng.Rows.count - 1)
Rng.Copy Sheets("Missing").Cells(Rows.count, 1).End(xlUp)(2)
Rng.EntireRow.Delete
.AutoFilterMode = False
End With
End Sub