ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   tranfer array to range (https://www.excelbanter.com/excel-programming/369862-tranfer-array-range.html)

AD108

tranfer array to range
 
Hello,

Forgive me if this shows up twice. I neglected the subject line.

I am trying to transfer a range to an array, then transfer the values back
to a different range, based on a condition. My array is returning
"subscript out of range" error. Thanks in advance for any help.

Sub TransferData()
Dim i As Integer
Dim x()
x = Range("AG3:AG398")
For i = 0 To 397
If IsEmpty(Cells(i + 3, 7)) Then
Cells(i + 3, 7).Value = x ( i )
End If
Next i

End Sub



NickHK[_3_]

tranfer array to range
 
Does this make sense for you ?
Dim x As Variant

x = Range("AG3:AG398").Value

Debug.Print LBound(x, 1) & " to " & UBound(x, 1)
Debug.Print LBound(x, 2) & " to " & UBound(x, 2)

NickHK

"AD108" .gbl...
Hello,

Forgive me if this shows up twice. I neglected the subject line.

I am trying to transfer a range to an array, then transfer the values back
to a different range, based on a condition. My array is returning
"subscript out of range" error. Thanks in advance for any help.

Sub TransferData()
Dim i As Integer
Dim x()
x = Range("AG3:AG398")
For i = 0 To 397
If IsEmpty(Cells(i + 3, 7)) Then
Cells(i + 3, 7).Value = x ( i )
End If
Next i

End Sub





AD108

tranfer array to range
 
Yes, I've got it working now. Thanks very much

"NickHK" wrote in message ...
Does this make sense for you ?
Dim x As Variant

x = Range("AG3:AG398").Value

Debug.Print LBound(x, 1) & " to " & UBound(x, 1)
Debug.Print LBound(x, 2) & " to " & UBound(x, 2)

NickHK

"AD108"

.gbl...
Hello,

Forgive me if this shows up twice. I neglected the subject line.

I am trying to transfer a range to an array, then transfer the values

back
to a different range, based on a condition. My array is returning
"subscript out of range" error. Thanks in advance for any help.

Sub TransferData()
Dim i As Integer
Dim x()
x = Range("AG3:AG398")
For i = 0 To 397
If IsEmpty(Cells(i + 3, 7)) Then
Cells(i + 3, 7).Value = x ( i )
End If
Next i

End Sub








All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com