Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Beginners Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kMan - 15 Feb 2007 23:00 GMT
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.
Gary''s Student - 15 Feb 2007 23:37 GMT
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?gclid=CKaVwuCGkIcCFSydFQodi1EBpg
Signature

Gary's Student
gsnu200706

> Hello all,
>
[quoted text clipped - 6 lines]
>
> Thanks for you assistance.
kMan - 16 Feb 2007 02:26 GMT
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?

> Once you have entered the macro, running it is as easy as :
>
[quoted text clipped - 35 lines]
> >
> > Thanks for you assistance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.