Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2009
    Posts
    6

    Question Unanswered: saving conditional formatting

    Hi, I'll start by declaring my "noobism"... please forgive me in advance for lame questions.

    Basically, I have used conditional formatting in Excel 2003 to great success. My problem is that I don't want to have to re-enter the formulas every time I create a new sheet (and I create a lot of new sheets).

    Less basically.... I export all data from a program called SAP into excel. I then run a macro (created by a magician who disappeared in a puff of smoke ) that formats my data to 99% of what I require. The missing 1% is colouring in. As I said, conditional formatting takes care of the 1%, but I have to re-enter the formulas with every new sheet.

    What I was hoping to do was "steal" the code from the conditional formatting and tack it into the macro via the VB editor so as to create a 100% solution.

    Am I on the wrong track?!

    Hope you can help.

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Hi and welcome!

    What I was hoping to do was "steal" the code from the conditional formatting and tack it into the macro via the VB editor so as to create a 100% solution.

    Am I on the wrong track?!
    You're on the right track. Assuming that you can see the macro code left by the magician, the next time that you set up the conditional formatting, start by going Tools -> Macro... -> Record New Macro. A dialogue box will appear, asking for a name, a shortcut key, a place to save the macro and a description. For this, I would advise that you put as the name "CFTest1" (on the grounds that it sometimes takes a while to get it right), ignore the shortcut key, select "Personal Macro Workbook" for saving and leave the description as it is. Click OK.

    A little toolbar will appear on your spreadsheet with a pause and a stop button. Create your formatting as normal, then click the stop button.

    Go into the VBA editor - with luck, it will open to Personal.xls. You should see the code, which you can then copy and paste to your main macro's code.

    Good luck!

  3. #3
    Join Date
    Apr 2009
    Posts
    6

    Thumbs up

    Success!!


    Such a good feeling when the macro finally runs how you want it to

    Thanks for the help.

  4. #4
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    You're welcome, and thanks for letting me know!

  5. #5
    Join Date
    May 2009
    Posts
    1
    Quote Originally Posted by weejas
    ....

    Go into the VBA editor - with luck, it will open to Personal.xls. You should see the code, which you can then copy and paste to your main macro's code.

    Good luck!
    Hi, another noob here Would it also be possible to call the new macro from within the main one? Sorry if this a ridiculous question!

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Yes.

    Create the macro(s) that you want to call from another one first. Then create your container macro and use the "Call" command:
    Code:
    Sub DoTheHardWork()
       Call WorkerMacro1
       Call WorkerMacro2
       Call WorkerMacro3
       'etc
    End Sub

Posting Permissions

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