ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing Excel Objects As Parameters (https://www.excelbanter.com/excel-programming/310313-re-passing-excel-objects-parameters.html)

Jake Marx[_3_]

Passing Excel Objects As Parameters
 
Hi MDW,

MDW wrote:
I see that we can pass Excel objects (ranges, worksheets, etc.)
around subs or functions as parameters. Is there any performance
impact to doing that? Is it more desirable to define things with a
global scope as an alternative?


I prefer passing references to Excel objects as opposed to using global or
module-level variables. It takes a bit more work upfront, but IMO it's
better in the long run. I wouldn't worry about a performance hit, as you're
not actually passing the object itself, just a reference to that object.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]



All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com