Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a worksheet that will calculate the cost of various services based on
the quantities and other information entered on a worksheet. Because this worksheet can be copied multiple times in the workbook, I added a button to the worksheet that will call a vba procedure that will contain the decision logic and the cost calculations. I would like to use named cells so that the logic is self-documenting for maintenance purposes. Due to the number of inputs to the procedure I don't want to pass the values entered as arguments. The inputs will not be modified only the costs cells so I was thinking of passing the sheet using ByVal. I can't find anything that says you couldn't do this in a book. Is this possible? Any gottcha's in doing this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi djd,
djd wrote: Due to the number of inputs to the procedure I don't want to pass the values entered as arguments. The inputs will not be modified only the costs cells so I was thinking of passing the sheet using ByVal. I can't find anything that says you couldn't do this in a book. Is this possible? Any gottcha's in doing this? I would use ByRef (default, so you can leave it out entirely) since you want to pass a reference to an object (Worksheet): Sub demo() DoCalcs Worksheets("Sheet1") End Sub Sub DoCalcs(rwsSource As Worksheet) MsgBox rwsSource.Name End Sub There aren't any gotcha's that I can think of. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to pass a variable from Form back to calling procedure | Excel Programming | |||
Pass switch to Main procedure | Excel Programming | |||
Can Not Add a Reference to a Procedure | Excel Programming | |||
How can I reference a procedure in an Add In? | Excel Discussion (Misc queries) | |||
How to pass an Excel range as an argument to a SQL Server stored Procedure | Excel Programming |