Hi All,
I'm pretty new to VBA
I have a column that, in some cells, contains more than one barcode. Some barcodes are prefixed with 361, others "C" (always split with a ",").
I'd like to ensure thatthe following occurs: ONLY if there is a "," insert a new column and call it Barcode2 - place all "C" barcode in column Barcode2
Tried to record a macro and use Text to columns but that wasnt successful either
Barcode1
36180111994529,C24999530
36180110815808,C24391067
36180111705578,C24702933
36180111855753,C24562171
36180113263667,C25195511
36180114534298
C26674047
36180101047171,C26674063
Note:
I dont use column number to id the column
There might be rows without a ", " i.e. only 1 barcode
There might be blank rows inbetween
I've got as fars as...
No idea if I'm on the right track or notDim LastRow2 As Long, LastCol2 As Integer, c2 As Integer, r2 As Long, found As Long
found = 0
LastRow2 = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
LastCol2 = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column
c2 = 1
Do While c2 <> LastCol + 1
r2 = 2
Dim cell, Barcode1 As Range
If Cells(1, c2) = "Barcode1" Then
Do While r2 <> LastRow2 + 1
If Range(Cells(2, c), Cells(LastRow, c)).Text = "*,*" Then
found = 1
Any advice appreciated
Thanks!
Bookmarks