Hi all,
I have a problem with my code. I need to delete all rows below last row with data in column B. Code below works, but I need to adjust it to delete all rows with no data in column B, but starting from row 10.
So it skips rows 1-9 (column B rows 1-9 contains blank cells). Any ideas how to improve it?
I have a problem with my code. I need to delete all rows below last row with data in column B. Code below works, but I need to adjust it to delete all rows with no data in column B, but starting from row 10.
So it skips rows 1-9 (column B rows 1-9 contains blank cells). Any ideas how to improve it?
VBA Code:
Sub PricingRemoveRows()
Dim WS As Worksheet
Dim LastCell As Range
Dim LastCellRowNumber As Long
Set WS = ThisWorkbook.ActiveSheet
With WS
Set LastCell = .Cells(.Rows.Count, "B").End(xlUp)
LastCellRowNumber = LastCell.Row
Rows(LastCellRowNumber + 1 & ":" & Rows.Count).Delete
End With
End Sub