Consulting

Results 1 to 2 of 2

Thread: macro to delete row if cell is empty

  1. #1

    macro to delete row if cell is empty

    I am looking for a macro that delete a row if cell in column B is empty.
    Thank you.

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings KillBill,

    I see that you just joined vbaexpress :-) Welcome here!

    For your current issue, try SpecialCells...

    Option Explicit
      
    Sub exampple()
      
      Me.Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
      
    End Sub
    PLease note that I used code within the Worksheet's module; thus - the Me keyword. Presuming your code is within a Standard Module, you will want to set an explicit reference to the range differently. As long as the sheet is going to remain in existence, I would suggest the sheet's CodeName.

    Hope that helps,

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •