Results 1 to 3 of 3

Thread: Need help. If Column cells are blank highlight entire row.

  1. #1

    Thread Starter
    Hyperactive Member simpleonline1234's Avatar
    Join Date
    Mar 2010
    Posts
    322

    Need help. If Column cells are blank highlight entire row.

    Hey guys I have a mind nubbing project going on. I'm trying to create this macro for work.

    What I am trying to do is create a macro that will look at an entire column....say for instance....Column D.

    If Column D contains a blank cell then I need to highlight the entire row that cell is on ....

    It's a comparison chart....Column C has an account status and on Column D I have a macro that will run a comparison again that column and return the results in cell D for each result.

    What I need help on is how to highlight the rows where cell D is blank.

    Any ideas on how to work this into a macro?

    Thanks


    Last edited by simpleonline1234; Nov 21st, 2011 at 01:01 PM.
    Are you down with OOP?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Need help. If Column cells are blank highlight entire row.

    try like
    vb Code:
    1. for each c in range("d:" & cells(rows.count, 4).end(xlup).row)
    2.   if isempty(c) then c.EntireRow.Interior.ColorIndex = 6
    3. next
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: Need help. If Column cells are blank highlight entire row.

    Why dont you just use conditional formatting?

    You could do it by selecting the entire area where your data is. Asuming A3 is the first cell in that range you select Home - Conditional Formatting - New Rule

    Select: Use a formula to determine which cells to format

    On the "Format values where this formula is true" field type:

    =($D3="")

    then select your format

    That's it. it should highlight the whole row.
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

Posting Permissions

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



Click Here to Expand Forum to Full Width