Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a worksheet that lists database fields, corresponding excel variables
and the data type for each. I'd like to run through the list of variables and declare each one with the appropriate data type. I've pasted the code snippet below: 'Load the Variables into an array ReDim DataVars(HowManyCols) As String ReDim DataOffset(HowManyCols) As String Dim Counter As Integer Counter = 1 'Dimension data and column offset variables For Each V In VarRange DataVars(Counter) = V.Value Select Case V.Offset(ColumnOffset:=1) Case Is = "Long" Dim DataVars(Counter) As Long Case Is = "String" Dim DataVars(Counter) As String Case Is = "Date" Dim DataVars(Counter) As Date Else Dim DataVars(Counter) As Variant End Select DataOffset(Counter) = V.Value & "_OFF" Dim DataOffset(Counter) As Integer Counter = Counter + 1 Next V When it hits the Dim statement, the Complie error is: Constant expression required. Any help you can offer would be greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Declare variables to a code? | Excel Discussion (Misc queries) | |||
Declare Variables in Array | Excel Discussion (Misc queries) | |||
Declare and Set Public variables | Excel Discussion (Misc queries) | |||
How to efficiently declare variables | Excel Discussion (Misc queries) | |||
Best place to declare variables | Excel Programming |