Results 1 to 6 of 6

how to delete indivudal cells

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-02-2005
    Location
    LONDON
    MS-Off Ver
    OFFICE365
    Posts
    168

    how to delete indivudal cells

    I found this macro that delete entire rows if cells in column B are empty.
     Sub Deleterows() 
    
    Dim lr As Long, i As Long 
    
    lr = Cells(Rows.Count, "A").End(xlUp).Row 
    
    For i = lr To 1 Step -1 
    If Cells(i, "B") = "" Then Rows(i).EntireRow.Delete 
    Next i 
    
    End Sub
    Can someone advise me if I have this correct if I want to delete CELLS in row "M"
    Sub Deleterows() 
    
    Dim lr As Long, i As Long 
    
    lr = Cells(Rows.Count, "A").End(xlUp).Row 
    
    For i = lr To 1 Step -1 
    If Cells(i, "M") = "" Then Rows(i).cells.Delete 
    Next i 
    
    End Sub
    Also is someone able to advise me on how to repeat it right the way down the workbook until last entry.
    Thanks
    Last edited by VBA Noob; 09-08-2007 at 01:14 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1