ramankumar
New Member
- Joined
- Sep 8, 2002
- Messages
- 33
Hi
I have variant array. IS there any way how to convert this to String array.
I have variant array. IS there any way how to convert this to String array.
Sub formula()
Dim fArray() As Variant
Dim sArray() As String
Dim lr As Long
Dim LRow As Long
With Sheet1
LRow = .Cells(4, 2).End(xlDown).Row
fArray = .Range(.Cells(4, 1), .Cells(LRow, 2))
ReDim sArray(UBound(fArray)) As String
For lr = 1 To UBound(fArray)
sArray(lr) = CStr(fArray(lr))
Next lr
Sheet2.Range(Cells(LRow + 7, 2), Cells(LRow + LRow, 4)) = sArray
End With
End Sub
I tired to apply this concept/code but am getting a subscript out of range error.
Rich (BB code):Sub formula() Dim fArray() As Variant Dim sArray() As String Dim lr As Long Dim LRow As Long With Sheet1 LRow = .Cells(4, 2).End(xlDown).Row fArray = .Range(.Cells(4, 1), .Cells(LRow, 2)) ReDim sArray(UBound(fArray)) As String For lr = 1 To UBound(fArray) sArray(lr) = CStr(fArray(lr)) Next lr Sheet2.Range(Cells(LRow + 7, 2), Cells(LRow + LRow, 4)) = sArray End With End Sub
not sure if I should submit this question to this old thread or start a new one?
thanks