私はVBAで少しのExcelマクロを書いています。今私は、2つの文字列を連結し、文字列配列に保存したいと思います。2つの文字列はVBA Excelを連結しません
Dim rowNumberString As String
Dim colIndexString As String
Dim headerArray(1 To colIndexArrayRange) As String
colIndexNumber = 14
colCount = 5
rowNumberString = "12"
addAnotherColumnToArray = True
' Fill the column array with all the month's entries
While addAnotherColumnToArray
colCount = colCount + 1
colIndexNumber = colIndexNumber + 1
If colIndexArray(colCount) = "" Then
colIndexString = Split(Cells(1, colIndexNumber).Address(True, False), "$")(0)
colIndexArray(colCount) = colIndexString & rowNumberString
End If
Debug.Print colCount & "=" & colIndexArray(colCount)
If (colIndexNumber > 61) Then
addAnotherColumnToArray = False
End If
Wend
出力:
6=O
7=P
8=Q
9=R
10=S
11=T
12=U
' ....
だから、この行ようだ:
` colIndexArray(colCount) = colIndexString & rowNumberString`
がStringにそれが必要な方法を連結されていない私が得たもの
。私は何を間違えたのですか?私は&
- オペレーターは常にVBAの文字列のために働くと思った。
ここでどのように 'colIndexArray'が定義されていますか? –
関連:https://stackoverflow.com/questions/1727699/how-to-concatenate-strings-in-vba – jsheeran
です。仕事には他に何かがあるはずです。 – Rory