running one macro from within another

B

Bob Reynolds

I have a rather large workbook and have one worksheet designed as a "data
entry form" and is used a the entry vehicle for another worksheet which is
my data source for a mail merge database.

I have approximately 55 entry fields in the "data entry form" and they are
broken down into several subareas. Example: Corporate information, Sole
Proprietorship information, Partnership information, subpoena information,
employee information and a couple more. I use a macro that I recorded in
"record macro" to select the unprotected cells for data entry into each of
the different subcategories. Sole Proprietorship requires different
information than the others.

The object of this is to have several cells selected and highlighted to
allow using the tab key to tab between the selected cells instead of row by
row for the entire sheet.

When the worksheet opens, I have all the editable cells change to a light
blue. I recorded this macro myself via the record feature.

I want to have the individual selections, enter sole prop info, enter
corporate, enter partnership info etc, select the appropriate cells that I
can tab through and color them a yellow. I know how to record the macro to
select the various cells and change them to the yellow color, but I also
must have it change the cells back to blue BEFORE it changes the cells
to yellow. The reason for this is to only have the entry cells as the off
color cells for each of the required data entry.

I am unable to get the macro recorder to follow me with the selecting of all
the cells and changing the colors and then selecting and chaging again. I'm
at a loss and hope I've given enrough information for someone.
thanks I am using Excell 200 and 2003
Bob Reynolds
 
B

Bernie Deitrick

Bob,

I'm not really following your logic in this step:
select the various cells and change them to the yellow color, but I also
must have it change the cells back to blue BEFORE it changes the cells
to yellow.

If you end up at yellow, why would they ever need to be blue... or am
I missing a step in there?

HTH,
Bernie
MS Excel MVP
 
B

Bernie Deitrick

Bob,

Do you know the macro's name and where it resides? If it is the
workbook open event (in the ThisWorkbook object's codemodule), then
you can move the code to another macro and call it from both the open
event as well as from your macro. If it is another macro already,
then you can simply call it, which an be as easy as just typing in the
macro name on its own line:

Sub Macro1()
Macro2
MsgBox "Goodbye"
End Sub

Sub Macro2()
MsgBox "Hi"
End Sub

Running Macro1 will first run Macro2.

HTH,
Bernie
MS Excel MVP
 
B

Bob Reynolds

The one simple little entry did exactly what I wanted. Thanks so much. I
couldn't find that anywhere but now that you've help I'll probably come
across it everywhere.
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top