Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginners Question GordyB Excel Discussion (Misc queries) 3 February 1st 10 10:33 PM
Beginners Question Black_op51 Excel Discussion (Misc queries) 6 November 8th 06 11:46 PM
Beginners Question setting up spreadsheet PappyJoe New Users to Excel 4 July 31st 06 04:33 AM
Beginners question: how to stop / abort execution of vba program Rainer[_3_] Excel Programming 15 June 6th 06 08:59 AM
Beginners question: VAT Column Dave Wallis Excel Worksheet Functions 2 December 18th 04 06:04 PM


All times are GMT +1. The time now is 05:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"