I have a list in column B that contains order ID's from different marketplaces.
I want in column F the name of the marketplace.
The way to recognize them is according to the length of the string (some are numbers only, some others are number and hyphens, 12345 = wholesale, 123-6789123-1210112 = amazon), others by some specific character (e.g. 1234567E = gogo, or 1234OB = open box).
I want to do it in VBA.
This is my code so far.
Sub profit()
Dim x As Long
Dim lastrow As Long
lastrow = Sheets("profit april 28 to may 11").Cells(Rows.Count,"b").End(xlUp).Row
For x = 6 To lastrow
If Cells(x, 1) = Cells(x, 2) Then
Cells(x, 6).Value = "wholesale"
Else: x = x + 1
End If
Next x
End Sub
This code works fine but only gives me wholesale orders by comparing values in column A and B. For the rest of ID's I don't have a reference column (like A). So I need to count the characters on the strings. But some strings have the same length, then I need to look for a second condition (12345678 and 1234567E have the same length but differ in one character). I would like to know how to count characters within a cell in vba and how to find specific character withing a string in VBA?