+ Reply to Thread
Results 1 to 7 of 7

Macro to remove entire row if null value exist in column C

  1. #1
    Registered User
    Join Date
    12-22-2012
    Location
    Basel
    MS-Off Ver
    Excel 2007
    Posts
    24

    Macro to remove entire row if null value exist in column C

    Hi

    How can I delete the entire rows if 'Null Values' are encountered in the cell of column C:C.
    e.g. c15, c18,c29, c32-34 etc


    Advance thanks for your help
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Macro to remove entire row if null value exist in column C

    Please Login or Register  to view this content.
    Last edited by JieJenn; 02-18-2013 at 01:45 PM.

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Macro to remove entire row if null value exist in column C

    Public Sub RemoveBlanks()

    Dim rng As Excel.Range
    Dim rw As Excel.Range

    Set rng = ThisWorkbook.Worksheets("Sheet2").Range("C:C")

    For Each rw In rng.Rows

    If rw.Cells(1, 1).Value = "" Or Asc(rw.Cells(1, 1)) = 13 Then
    rw.Delete
    End If

    Next rw

    End Sub

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to remove entire row if null value exist in column C

    nathansav,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Macro to remove entire row if null value exist in column C

    another

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Registered User
    Join Date
    12-22-2012
    Location
    Basel
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to remove entire row if null value exist in column C

    Dear nathansav & Jen,

    Thanks for your quick response.

    I have used the macro but still so many blank cells are there in column 'C'.

    May I request you to check in my attached spreadsheet as I m still so many cells with null value

  7. #7
    Registered User
    Join Date
    12-22-2012
    Location
    Basel
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to remove entire row if null value exist in column C

    Thank you very much Mike. Its working perfectly now.

+ Reply to Thread

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