Dear All,
I have array codes, thats store specific data from row and colomn. All already store in array but i can't fill it's to many row in other sheet. my codes only fill in one colomn
Here are my code:
Appreciate to hear the comment from you.
File example: Send.xlsm
Thank you
Rgrds,
I have array codes, thats store specific data from row and colomn. All already store in array but i can't fill it's to many row in other sheet. my codes only fill in one colomn
Here are my code:
Code:
sub array1()
Dim startrow As Long, lastrow As Long, a As Long, b As Long, c As Long, i As Long, size1 As Long
Dim startrow1 As Long, lastrow2 As Long, a1 As Long, b1 As Long
Dim myArr()
Dim myRow As Long, myCol As Long
Dim myRow1 As Long, myCol1 As Long
Dim myRowValue As String
Dim myRowValue1 As String
Dim colValue1 As String, colValue2 As String, colValue3 As String, colValue4 As String, colValue5 As String
Dim trd1 As String, bsl1 As String, int1 As String, fam1 As String, grp1 As String
Worksheets("S2").Activate
startrow = 2
lastrow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row 'the last row with data
myCol = 1
size1 = 1
For a = startrow To lastrow
myRowValue = Cells(a, myCol).Value
colValue1 = Cells(a, myCol + 1).Value
colValue2 = Cells(a, myCol + 2).Value
colValue3 = Cells(a, myCol + 3).Value
colValue4 = Cells(a, myCol + 4).Value
colValue5 = Cells(a, myCol + 5).Value
myRow = a
ReDim Preserve myArr(i)
myArr(i) = myArr(i) & myRow & "," & myRowValue & "," & colValue1 & "," & colValue2 & "," & colValue3 & "," & colValue4 & "," & colValue5
i = i + 1
Next a
For b = LBound(myArr) To UBound(myArr)
n = Split(myArr(b), ",")
For c = LBound(n) To UBound(n)
myRow = n(c)
trd1 = n(c + 1)
bsl1 = n(c + 2)
int1 = n(c + 3)
fam1 = n(c + 4)
grp1 = n(c + 5)
If int1 = "E" Then
Worksheets("Database").Activate
startrow1 = 6
lastrow1 = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row 'the last row with data
myCol1 = 1
Do Until startrow1 = lastrow1 + 1
Cells(startrow1, myCol1) = trd1
startrow1 = startrow1 + 1
GoTo nextN
Loop
Else
GoTo nextN
End If
Next c
nextN:
Next b
end sub
File example: Send.xlsm
Thank you
Rgrds,