By Ajeet Kumar
EXCEL VBA TO FILL A
RANGE ROW WISE USING ARRAY
Sub Fill2DArrHorizonal()
Dim Arry(1 To 5, 2
To 7)
Dim lngR As Long
Dim lngC As Long
Dim K As Long
For lngR =
LBound(Arry, 1) To UBound(Arry, 1)
For lngC =
LBound(Arry, 2) To UBound(Arry, 2)
Arry(lngR,
lngC) = K + 1
K = K + 1
Next
Next
Range("A1").CurrentRegion.Clear
Range("A1").Resize(5 - 1 + 1, 7 - 2 + 1) = Arry
End Sub
EXCEL VBA TO FILL A
RANGE COLUMN WISE USING ARRAY
Sub Fill2DArrVertical()
Dim Arry(1 To 5, 2
To 7)
Dim lngR As Long
Dim lngC As Long
Dim K As Long
For lngC =
LBound(Arry, 2) To UBound(Arry, 2)
For lngR =
LBound(Arry, 1) To UBound(Arry, 1)
Arry(lngR,
lngC) = K + 1
K = K + 1
Next
Next
Range("A1").CurrentRegion.Clear
Range("A1").Resize(5 - 1 + 1, 7 - 2 + 1) = Arry
End Sub