Page 1 of 2 12 LastLast
Results 1 to 10 of 15
Like Tree1Likes

Can't record macro for Conditional Formatting

This is a discussion on Can't record macro for Conditional Formatting within the Excel Questions forums, part of the Question Forums category; I am trying to record a macro for conditional formatting but when I check the VB Editor after I finish ...

  1. #1
    Board Regular wilkisa's Avatar
    Join Date
    Apr 2002
    Location
    Decatur IL, USA
    Posts
    572

    Default Can't record macro for Conditional Formatting

    I am trying to record a macro for conditional formatting but when I check the VB Editor after I finish recording it, it only has

    Sub CFTest()
    '
    ' CFTest Macro
    '

    '
    Range("D1:D4").Select
    End Sub


    Can someone help me get the keystrokes to record or tell me what I need to do?

    Thanks,
    Shirlene

  2. #2
    Board Regular
    Join Date
    Apr 2004
    Posts
    6,715

    Default Re: Can't record macro for Conditional Formatting

    What exactly are you trying to do ?
    Yesterday I felt on top of the world. Today its falling in on me.

  3. #3
    Board Regular wilkisa's Avatar
    Join Date
    Apr 2002
    Location
    Decatur IL, USA
    Posts
    572

    Default Re: Can't record macro for Conditional Formatting

    I am testing conditional formatting in a macro. I am trying to record my setup to use in an existing macro. I can modify it, I think, once I get the code "on paper". I turn on the RECORD MACRO and I'm naming it CFTEST. I am using range D1:D4 with my test values.

    If the cell value <=Today(), change the font color to BOLD RED with GRADIENT WHITE/PINK FROM CENTER. If the cell value is between =Today() and =Today()+14, change the font to BOLD BLACK. If the cell value is between =Today()+14 and =Today()+30, change the font to BOLD ORANGE.

    I cannot get any of these conditions to record. Can you help?
    Thanks,
    Shirlene

  4. #4
    Board Regular
    Join Date
    Apr 2004
    Posts
    6,715

    Default Re: Can't record macro for Conditional Formatting

    1st thing is that your parameters overlap.

    I assume you have more than 3 formats to apply ?
    Yesterday I felt on top of the world. Today its falling in on me.

  5. #5
    Board Regular wilkisa's Avatar
    Join Date
    Apr 2002
    Location
    Decatur IL, USA
    Posts
    572

    Default Re: Can't record macro for Conditional Formatting

    The fact that my parameters overlap doesn't have anything to do with the keystrokes not recording. I appreciate that fact that you are taking time to look at this but would you please address my problem? I can tweak my parameters after I get it into VB.
    Thanks,
    Shirlene

  6. #6
    Board Regular
    Join Date
    Apr 2004
    Posts
    6,715

    Default Re: Can't record macro for Conditional Formatting

    Have a look at jonmo1's solution, here

    Conditional Formatting VBA help!!
    Yesterday I felt on top of the world. Today its falling in on me.

  7. #7
    Board Regular wilkisa's Avatar
    Join Date
    Apr 2002
    Location
    Decatur IL, USA
    Posts
    572

    Default Re: Can't record macro for Conditional Formatting

    Thanks, Steve. I'll see what I can do with that.

  8. #8
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    32,050

    Default Re: Can't record macro for Conditional Formatting

    My guess is that you're not "Completing" the setup of the conditional format.

    The macro recorder doesn't record your conditions untill you click OK all the way through,and are back at the sheet and the conditional formatting is actually functioning.

    If you're just going in and putting in the criteria and selecting the format, then clicking Cancel, that's why it's not being recorded.
    pdevito3 likes this.
    Want better/faster responses to your questions?
    Use Excel Jeanie to post samples of your sheet.

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

  9. #9
    Board Regular wilkisa's Avatar
    Join Date
    Apr 2002
    Location
    Decatur IL, USA
    Posts
    572

    Default Re: Can't record macro for Conditional Formatting

    Thanks for the reply, Jonmo. I recorded my macro again. For each step in the condition, I hit APPLY before I hit New Rule for the next condition. I verified that I completed it and hit OK when done. I then opened the VBEditor and checked the module; it is just exactly as I pasted it in the first part of this thread.

    Do I need to enable or add something? I'm just stumped!
    Thanks,
    Shirlene

  10. #10
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    32,050

    Default Re: Can't record macro for Conditional Formatting

    Sorry, I've been unable to duplicate the problem. It records for me.

    Does it record ANYTHING? Like just go selecting some cells and typing random stuff.
    Does it record that?

    Are macros Enabled?

    And please forgive the silliness of this question, but...

    Are you clicking "Stop Recording" before going into the VBA window and checking the code?
    Want better/faster responses to your questions?
    Use Excel Jeanie to post samples of your sheet.

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

Page 1 of 2 12 LastLast

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com