Home > Software engineering >  How the area is defined as a variable, and then call these variables?
How the area is defined as a variable, and then call these variables?

Time:10-01

Say clearly!
I need operation for the following areas:
The Set TSG=Union ([C2: C9], [E5: E9], [G6: the G8], [I7: I14], [k10/19 dated: K15], [O2: O16], [S2: S15])
The Set tig=Union ([A2, A4], [E2: E4], [G2: G5], [I2: I6], [K2: K9], [M2: M14], [Q2: Q10], [U2: U7])
The Set tog=Union (TSG, tig)
Several command buttons and SelectionChange event are used in these areas, use the stupid method is currently defined in each button and SelectionChange event again.
So I'd like to have this several regions defined as a variable, just call the area that in the rest of the variables,
But don't know how to write code,

CodePudding user response:

Global variables in the workbook open event in the assignment, the direct reference in other ways,

CodePudding user response:

Also can try to use name:
 Option Explicit 
Sub test ()
The Debug. Print ThisWorkbook. Names (" wer "). RefersToRange. Address
End Sub



The "wer" is the name of them
  •  Tags:  
  • VBA
  • Related