Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default How to pass sheet reference to a procedure

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
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
How to pass a variable from Form back to calling procedure John[_111_] Excel Programming 4 August 21st 05 03:54 PM
Pass switch to Main procedure Bob Phillips[_6_] Excel Programming 0 August 3rd 05 11:23 PM
Can Not Add a Reference to a Procedure GordonC Excel Programming 2 March 1st 05 07:45 PM
How can I reference a procedure in an Add In? June Macleod Excel Discussion (Misc queries) 4 November 30th 04 06:35 PM
How to pass an Excel range as an argument to a SQL Server stored Procedure Belinda Excel Programming 7 April 8th 04 11:24 AM


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

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

About Us

"It's about Microsoft Excel"