Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Beginners Question
Hello all,
I wrote a function that returns the value to the cell in which it is executed and modifies adjacent cell, but apparently you couldn't do that as functions aren't allowed to READ or MODIFY contents of other cells? So I have to write a sub procedure it seems. My question to you is, how could I execute a sub procedure, and how would I pass arguments to it? Thanks for you assistance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Beginners Question
Once you have entered the macro, running it is as easy as :
1. ALT-F8 2. select the macro 3. touch run Macros can have arguments, but that's mostly for macros called by other macros or event macros. Usually macros pickup information from worksheet cells and user input. For example, you originally tried a function and wanted a result in a cell and its adjacent neighbor. In using a sub you could just select that cell in the worksheet and run the macro. To put a value in the selected cell: ActiveCell.Value=whatever to put a value in the adjacent cell: ActiveCell.Offset(0,1).Value=whichever start out by reading: http://www.mvps.org/dmcritchie/excel/getstarted.htm or http://www.lqnet.com/Excel/Excel.asp...FSydFQodi1EBpg -- Gary's Student gsnu200706 "kMan" wrote: Hello all, I wrote a function that returns the value to the cell in which it is executed and modifies adjacent cell, but apparently you couldn't do that as functions aren't allowed to READ or MODIFY contents of other cells? So I have to write a sub procedure it seems. My question to you is, how could I execute a sub procedure, and how would I pass arguments to it? Thanks for you assistance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Beginners Question
Thanks for replying Gary's Student....
I had trouble with running macros as I had defined them as "Private". Taking it out allows me to select a macro to run. I have another question for you. How could I run macros over a range of cells. You know how you could copy a function in cell and paste it over a range of cells to repeat function. Is it possible to do something with macros to achieve similar effect? "Gary''s Student" wrote: Once you have entered the macro, running it is as easy as : 1. ALT-F8 2. select the macro 3. touch run Macros can have arguments, but that's mostly for macros called by other macros or event macros. Usually macros pickup information from worksheet cells and user input. For example, you originally tried a function and wanted a result in a cell and its adjacent neighbor. In using a sub you could just select that cell in the worksheet and run the macro. To put a value in the selected cell: ActiveCell.Value=whatever to put a value in the adjacent cell: ActiveCell.Offset(0,1).Value=whichever start out by reading: http://www.mvps.org/dmcritchie/excel/getstarted.htm or http://www.lqnet.com/Excel/Excel.asp...FSydFQodi1EBpg -- Gary's Student gsnu200706 "kMan" wrote: Hello all, I wrote a function that returns the value to the cell in which it is executed and modifies adjacent cell, but apparently you couldn't do that as functions aren't allowed to READ or MODIFY contents of other cells? So I have to write a sub procedure it seems. My question to you is, how could I execute a sub procedure, and how would I pass arguments to it? Thanks for you assistance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Beginners Question | Excel Discussion (Misc queries) | |||
Beginners Question | Excel Discussion (Misc queries) | |||
Beginners Question setting up spreadsheet | New Users to Excel | |||
Beginners question: how to stop / abort execution of vba program | Excel Programming | |||
Beginners question: VAT Column | Excel Worksheet Functions |