Forum Discussion
phimmychan35
Jan 03, 2024Copper Contributor
Matching help
Hello. I am now manually matching divisions and products in Excel and it takes so much time and causes many errors. May anyone help with my case? 1. I have 103 division names and 24 product names...
- Jan 03, 2024
Sub division() Dim i, j, l As Long Range("E2:G1048576").Clear l = 2 For i = 2 To 104 For j = 2 To 25 Cells(l, 5).Value = Cells(i, 1).Value Cells(l, 6).Value = Cells(j, 2).Value l = l + 1 Next j Next i End Sub
In the attached file you can run this macro by clicking on the button in cell I2.
OliverScheurich
Jan 03, 2024Gold Contributor
Sub division()
Dim i, j, l As Long
Range("E2:G1048576").Clear
l = 2
For i = 2 To 104
For j = 2 To 25
Cells(l, 5).Value = Cells(i, 1).Value
Cells(l, 6).Value = Cells(j, 2).Value
l = l + 1
Next j
Next i
End Sub
In the attached file you can run this macro by clicking on the button in cell I2.
- phimmychan35Jan 03, 2024Copper Contributor
Hi, Oliver. Thank you so much! I do appreciate it!