+ Reply to Thread
Results 1 to 7 of 7

Highlighting Macro?

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    5

    Highlighting Macro?

    Hi! I've searched everywhere for a basic macro (not sure if that's even what I need) to add to my current code. What I'm looking to do is similar to what my timestamp macro does, but with highlighting.....

    Ex. Enter "NAME" in cell 1 (column F, row 1655) and have cell 2 (column A, row 1655) highlighted yellow.

    Also another similar concept, but with the whole row being highlighted....

    Ex. Enter "X" in cell 3 (column H, row 1655) and have all of row 1655 highlighted yellow.

    Any help would be greatly appreciated. File attached.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Highlighting Macro?

    Rather than coding it, why not use the built-in conditional formatting? If you are willing to go this direction, with Cell A1655 active (for example):

    1. Click the Home Tab >> Conditional Formatting >> New Rule >> 'Use Formula to Determine Which Cells to Format'

    2. Enter the formula =IF(A1655)<>"" (if you click choose the cell, it will make an absolute reference to the cell ($A$1655). In this case you will need to remove the $ if your wish is to format paint this conditional formatting to additional cells).

    3. With the dialog box still open, choose Format button >> Select Yellow Color >> Click OK.

    You can now format paint (paint brush in Clipboard group of Home Tab) this cell down and up as applicable if your desire is to always have the A column appear Yellow (highlighted) if a name is chosen in column F.

    In your second question, you could also use conditional formatting, but if you're after vba:

    Notes: Make a copy of your workbook and run the code on the copy first as a test. VBA is very difficult to undo. The following code will apply entire row highlighting to all rows in which an X is entered in the corresponding Column H.

    Please Login or Register  to view this content.
    Last edited by AlvaroSiza; 02-29-2012 at 03:03 AM.

  3. #3
    Registered User
    Join Date
    02-28-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlighting Macro?

    Just grabbing my morning coffee, I'll give this a shot today. Thanks for the response!

  4. #4
    Registered User
    Join Date
    02-28-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlighting Macro?

    Unfortunately, I couldn't get either of these to work. With the conditional formatting, I get an error message ("The formula you typed contains an error") when I click "ok" and cannot add the new rule to the workbook.

    For the VBA code, I forgot to mention that I have an existing macro in VBA to handle timestamping. Could this be preventing it from work?

    Not sure what I'm doing wrong. :-(

  5. #5
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Highlighting Macro?

    It was late when I submitted that. Could have used some of your coffee

    RE:Conditional Formatting: In Cell A1655, follow same steps, but formula should read =F1655<>"" (then choose color and "ok" your way out).

    RE: Code: Your timestamp code will not cause issue. The code I provided would be copied and pasted into a module (not in the 'Sheet2(Production Log)' where your timestamping occurs). Nothing will happen unless you run the code, which I would suggest tying to a button that you can click. Let me know if if you do not know how to get the code where it needs to be or if you do not know how to assign it to a button.

  6. #6
    Registered User
    Join Date
    02-28-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlighting Macro?

    The conditional formatting part worked great! Thanks! Wasn't sure how to work with the module, but you said that the "highlighting the row" task can be taken care of with conditional formatting as well? I tried the following the steps, but started with selecting the whole row and I got that error message again. Is there a separate formula for highlighting a whole row?

  7. #7
    Registered User
    Join Date
    02-28-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Highlighting Macro?

    Hi Again...I've tried a number of things to get the whole corresponding row to highlight, after entering an "x" into column H, but I'm getting some random cells to highlight. Please help I'm just looking for a conditional format rule now.

    Thanks!

+ 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