View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
marcus[_3_] marcus[_3_] is offline
external usenet poster
 
Posts: 140
Default Deleting Empty Rows using VBA code without the need to activatesh

Hi Roger

You did not specify which sheets you wanted the blanks in Col B
deleted. The following works on all sheets.

Take care

Marcus

Option Explicit
Sub DelBlankColB()

Dim lw As Integer
Dim ws As Worksheet

Application.ScreenUpdating = False

For Each ws In ThisWorkbook.Worksheets
lw = ws.Range("B" & Rows.Count).End(xlUp).Row
ws.Range("B1:B" & lw).SpecialCells
(xlCellTypeBlanks).EntireRow.Delete
Next ws

End Sub