Forum Discussion

phimmychan35's avatar
phimmychan35
Copper Contributor
Jan 03, 2024

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...
  • OliverScheurich's avatar
    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.

Resources