Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
constants
Hi, I'm using Worksheet_SelectionChange event in my workbook. On the very
begining of procedure I have some values initialized that I want to be constants like this: Dim x, y As String x = "C1" y = "H3" ... I guess it's bad solution to have them initialized in the event procedure because this way they get initialized every time event occurs. Where can I put them to be initialized once and visible for Worksheet_SelectionChange and other subs? Shall I also set them at nothing and where when exiting workbook? Thanx alekmil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
constants
There shouldn't be any major penalty with initializing then in the Change
event since that is the only place they are used. When the change event ends, they are destroyed, so there is no requirement to explicitly do anything else to them. Also, note that when you declare the type for a variable in VBA, you need to declare the type for each variable. Dim x, y as String x is a variant y is a string Dim x as String, y as String x is a string y is a string -- Regards, Tom Ogilvy "alekm" wrote in message ... Hi, I'm using Worksheet_SelectionChange event in my workbook. On the very begining of procedure I have some values initialized that I want to be constants like this: Dim x, y As String x = "C1" y = "H3" ... I guess it's bad solution to have them initialized in the event procedure because this way they get initialized every time event occurs. Where can I put them to be initialized once and visible for Worksheet_SelectionChange and other subs? Shall I also set them at nothing and where when exiting workbook? Thanx alekmil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Constants in Excel | Excel Discussion (Misc queries) | |||
Range Name Constants | Excel Discussion (Misc queries) | |||
Constants In Formulae | Excel Discussion (Misc queries) | |||
Flagging constants | Excel Worksheet Functions | |||
constants | Excel Discussion (Misc queries) |