Hello
As a bit of context. I have a large file with about 150 different suppliers. I want to make a macro which loops through each of these suppliers, and copies each row which contains a supplier into a different file. So for example if there are 6 rows of supplier 6, then all these rows are copied to a new file.
I am working on the first part of identifying the unique suppliers, for the moment just marking them with a unique value (numbered 1 - 150). This is my code so far:
Sub invoiceSupplierSplit()
Worksheets("Invoice Report").Activate
Cells(2, 73) = "Unique Supplier"
Dim i As Integer
i = 3
Do While Cells(i, 2).Value <> ""
Cells(i, 73) = "value"
i = i + 1
Loop
End Sub
So it loops through Column B, as long as the cell is not empty then put value into its counterpart on column BU. SO if B2 has something, then BU2 = value
How could I check that if B2 and B3 are equal write i to BU2, then if B3 and B4 are equal i to BU3. However if B4 and B5 are different then write i+1 to BU4 and so on until the end of the file.
This code is more a proof of concept before I continue and copy these values instead of just writing to the end column
I hope this makes sense and any help would be very much appreciated
Josh
As a bit of context. I have a large file with about 150 different suppliers. I want to make a macro which loops through each of these suppliers, and copies each row which contains a supplier into a different file. So for example if there are 6 rows of supplier 6, then all these rows are copied to a new file.
I am working on the first part of identifying the unique suppliers, for the moment just marking them with a unique value (numbered 1 - 150). This is my code so far:
Sub invoiceSupplierSplit()
Worksheets("Invoice Report").Activate
Cells(2, 73) = "Unique Supplier"
Dim i As Integer
i = 3
Do While Cells(i, 2).Value <> ""
Cells(i, 73) = "value"
i = i + 1
Loop
End Sub
So it loops through Column B, as long as the cell is not empty then put value into its counterpart on column BU. SO if B2 has something, then BU2 = value
How could I check that if B2 and B3 are equal write i to BU2, then if B3 and B4 are equal i to BU3. However if B4 and B5 are different then write i+1 to BU4 and so on until the end of the file.
This code is more a proof of concept before I continue and copy these values instead of just writing to the end column
I hope this makes sense and any help would be very much appreciated
Josh