how to link CSVTypeColumn
= CSVType01
= "AL"
?
Its has anyway to let if CSVTypeColumn.value
= CSVType01
Then CSVTypeColumn.value
= "AL"
?
'''''Module1
Public CSVType01 As String
CSVType01 = "AL"
'''''Module2
For CSVTypeColumnCount = 1 To 6
Dim CSVTypeColumn As String
CSVTypeColumn = "CSVType0" & CSVTypeColumnCount
Dim FindCSVType As Range
Set FindCSVType = .Range(CSVTypeColumn & 1).Column '<-- Wrong here!
CodePudding user response:
Use an array:
Public CSVType(1 To 6) As String
CSVType(1) = "AL"
' etc
For CSVTypeColumnCount = 1 To 6
Dim CSVTypeColumn As String
CSVTypeColumn = CSVType(CSVTypeColumnCount)
CodePudding user response:
That does not work. When ever you have the feeling you need no use numbers in your variable names then you are doing it wrong!
Use arrays instead.
Public CSVType(1 To 6) As String
CSVType(1) = "AL"
CSVTypeColumn = CSVType(CSVTypeColumnCount)