Data for my problem are provided below:
#define apple
#define mango
#define banana
animals{
dog,
cat,
bird
#define guava
#define avocado
Strings with #define are set to color index = 50, the rest are set to color index = 23
What I want to do is that I want to find the word "animals", and I would like it to look at the next column up until the next column has a #define. If the next column has no #define, it numbers it with '0', the next column '1' and so on and so forth thus the result would be like this:
#define apple
#define mango
#define banana
animals{
dog, 0
cat, 1
bird 2
#define guava
#define avocado
My code is as follows but it does not move to the next column as planned.
For Each cell In DataRange.Cells
If InStr(cell.Value, "animals") <> 0 Then
Do Until ActiveCell.Font.ColorIndex = 50
cell.Value = cell.Value & o
o = o + 1
cell.Offset(0, 1).Select
Loop
End If
Next
Thanks