If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > saving conditional formatting

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-07-09, 05:07
Dalman71 Dalman71 is offline
Registered User
 
Join Date: Apr 2009
Posts: 6
Question 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.
Reply With Quote
  #2 (permalink)  
Old 04-07-09, 06:00
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
Hi and welcome!

Quote:
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!
Reply With Quote
  #3 (permalink)  
Old 04-07-09, 18:15
Dalman71 Dalman71 is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 04-08-09, 05:42
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You're welcome, and thanks for letting me know!
Reply With Quote
  #5 (permalink)  
Old 05-05-09, 17:38
lappyslappy lappyslappy is offline
Registered User
 
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!
Reply With Quote
  #6 (permalink)  
Old 05-26-09, 10:06
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On