Hi! I need some help with a nested if function.
There is a code which checkes for every word in my list and excutes some command based on the value of the cell. However, if the cell's value is on my list, then the "pair" of the word should be the cell's value which is stored on a list.
Example:
__________________________
If ..... 'some irrelevant code
' and here comes the thing:
ELseIf Cells(i,1).Value ="dog" then Cells(i,5).Value="Pine"
ElseIf Cells(i,1).Value="cake" then Cells(i,5).Value= "Banana"
...
And so on.
So I have a list and I want to insert the code above into 1 "ElseIf" part, instead of writing more hundred lines of code for each word in my list.
// my list:
dog Pine
cake Banana
cacti Apple
pet Fruit
... and so on (106 pairs)
___________________________
Do you have any idea?
It would be great if my list could be stored inside my VBA code as a collection ( ? I don't know much aboit it)
If this is not possible, then I make a new worksheet containing my list in columns A-B)
Thank you for your help!
Have a nice day!
There is a code which checkes for every word in my list and excutes some command based on the value of the cell. However, if the cell's value is on my list, then the "pair" of the word should be the cell's value which is stored on a list.
Example:
__________________________
If ..... 'some irrelevant code
' and here comes the thing:
ELseIf Cells(i,1).Value ="dog" then Cells(i,5).Value="Pine"
ElseIf Cells(i,1).Value="cake" then Cells(i,5).Value= "Banana"
...
And so on.
So I have a list and I want to insert the code above into 1 "ElseIf" part, instead of writing more hundred lines of code for each word in my list.
// my list:
dog Pine
cake Banana
cacti Apple
pet Fruit
... and so on (106 pairs)
___________________________
Do you have any idea?
It would be great if my list could be stored inside my VBA code as a collection ( ? I don't know much aboit it)
If this is not possible, then I make a new worksheet containing my list in columns A-B)
Thank you for your help!
Have a nice day!
Last edited: