View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David McRitchie[_2_] David McRitchie[_2_] is offline
external usenet poster
 
Posts: 134
Default Record Worksheet Content as Macro and Execute from another Worksheet

Hi Warwick,
As far as I know noone would place the contents of sheet1 into
a macro because you can simply create a copy of a worksheet.
You may be thinking along the lines of copy and paste, but if it
is for an entire sheet you might do the following:

manually:
Edit, Move or copy sheet..., place a checkmark next to Copy.

in VBA:
'Create New Sheet
Sheets.Add 'defaults before
'Rename current Sheet
ActiveSheet.Name = "Renamed14a"

Not clear on what you want though, in order to write a macro
you usually need to know exactly how to do something manually.

You get best results in the newsgroups if you have a specific
question on what you need help with and I think your question
is much too general and not clear on what you want accomplished.

Are you trying to create as many sheets as you have rows
in Sheet2. or perhaps modify as many rows as you have cells
in column a of sheet2.

I suggest you practice manually getting the results you want
so that you can perhaps record a macro, and better explain
what you need. The recorded macro will tell
you what kind of instructions you need, it will not generate
programming loops for you.

If you can find code that almost does what you want then
you are half way to a solution of your own. You can find
lots of solutions to problems in web pages and in Google Groups
archives if you can figure out what to search on.
http://www.mvps.org/dmcritchie/excel/xlnews.htm
and see my search page below.

I think you are trying to in get too deep all at once. See my
excel.htm page below for some tutorials, once you have learned
from them, suggest the fastest way would be to purchase a book
and by going over the free tutorials you should be able to bypass
the real elementary books.

BTW, since this appears to be your first posting in Excel groups, it
is possible that you do not know how to install a macro, you can
get instructions to install and invoke in
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and I would practice with some macros that you can know exactly
what it does and would be useful to you see
http://www.mvps.org/dmcritchie/excel/proper.htm
http://www.mvps.org/dmcritchie/excel/join.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Warwick Renshaw" wrote in message . ..
Could someone advise me how to...

a)Record the contents of sheet1 as a macro
b)Execute the recorded macro from multiple cells within sheet2

Sheet1 contains a financial model. The model reads an input parameter
(cell A1), performs a calculation (cells B1:Y99), and outputs a result
(cell X99).

Sheet2 contains a list of parameters (cells A1:A999) and a list of
results of the corresponding calculations performed by the macro
(cells B1:B999).

I would like Excel to execute the macro repetitively, progressively
working down the input parameters recorded in cells A1 to A99 in
Sheet2 and recording the results from the model in cells B1 to B99 in
Sheet2.

I am new to macros and don't understand how to record the contents of
an existing sheet as a macro.
I also do not understand how to specify, at multiple points within a
sheet, that the macros has to be executed, and that it should accept
the contents of a specific cell as input.

In practice this macro would be executed several thousand times,
reading a couumn of parameters and producing a column of results.