Autumnscribe
New Member
- Joined
- Jul 10, 2021
- Messages
- 8
- Office Version
- 2016
Hi All
Disclosure: I've cross posted this here but no solution yet.
VBA novice. Need to roll-up product lines to the SKU level. E.g. I've got:
And I want:
I haven't been able to get a concat formula or the & built in concat working.
Disclosure: I've cross posted this here but no solution yet.
VBA novice. Need to roll-up product lines to the SKU level. E.g. I've got:
Item_ID | Distribution Type | SKU number |
---|---|---|
HELPER ROW | ||
5327978 | DC | 673386 |
5327978 | DSD | 673386 |
And I want:
Item_ID | Distribution Type | SKU number |
---|---|---|
5327978 | DC DSD | 673386 |
I haven't been able to get a concat formula or the & built in concat working.
VBA Code:
Sub ConCatToSKU()
'Note for testing - delete any rows past 20
Dim LastRow As Integer
Dim CurrentRow As Integer
LastRow = ActiveSheet.UsedRange.row - 1 + ActiveSheet.UsedRange.Rows.Count
CurrentRow = 2
Range("A:A").NumberFormat = "General"
Do While CurrentRow <= LastRow
' Writes a flag in an unused cell I can use as an IF criteria
If IsEmpty(Range("E" & CurrentRow).Value) = True Then
Range("DA" & CurrentRow).Value = "ZZZZ"
If Range("DA" & CurrentRow).Value = "ZZZZ" Then
'I was just testing writing a formula into the helper row
Range("E" & CurrentRow).Formula = "=Concat(E3,E5)"
'I NEED TO HAVE THIS CONCAT FORMULA RUN FOR ALL THE UNIQUE VALUES IN COL E
End If
End If
CurrentRow = CurrentRow + 1
Loop
End Sub