airforceone
Board Regular
- Joined
- Feb 14, 2022
- Messages
- 201
- Office Version
- 2019
- 2016
- Platform
- Windows
00000 TEMPLATE.xlsx | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Copied Entry | Expected Result | ||||
2 | Dog*Brown,White,Black,Dragon*Golden,Green,Red,Black,Panda*Red,Black,Green | Dog*Brown,White,Black | Dragon*Golden,Green,Red,Black | Panda*Red,Black,Green | ||
Sheet1 (2) |
As shown above I would like to parse the cell value for every "*" entry to arrive at the expected result, below is my somewhat working code
Number of Pet may go up as many as 8 sets, in the above example we have 3 Pet Sets ie. Dog, Dragon and Panda.
VBA Code:
Sub ListOfAnimals()
Dim aPets() As String
Dim iCTR As Long
aPets = Split(Cells(2, 1), "*")
For iCTR = LBound(aPets) To UBound(aPets)
Debug.Print aPets(iCTR)
Next
End Sub