Hello,
I'm just getting started with trying to write macros for Excel. I have minimal JavaScript knowledge, so I understand parts of it but I'm not totally sure of the correct language. I'm trying to create a macro that will reference another cell and add a value in a different cell based on what that cell says.
For example, the logic would be something similar to this:
If cell A:1 = orange then cell P:1 = fruit.
The complex part is that I need it to run through several checks before continuing onto the next cell in the column, so it would have to go through the following:
If cell A:1 = orange then cell P:1 = fruit
If cell A:1 = desk then cell P:1 = furniture
If cell A:1 = Texas then cell P:1 = state
If cell A:1 = red then cell P:1 = color
If cell A:1 = hot then cell P:1 = temperature
If cell A:1 = shirt then cell P:1 = clothing
If cell A:1 = ring then cell P:1 = jewelry
If cell A:1 = male then cell P:1 = gender
If cell A:1 = Thursday then cell P:1 = day
If cell A:1 = Christmas then cell P:1 = holiday
If cell A:1 = dog then cell P:1 = mammal
If cell A:1 = sad then cell P:1 = emotion
The macro would have to run through all of those checks for each cell clear down until there is a blank cell in column A. Once it reaches that point, it would need to go back to the top of column A and start doing the same thing to populate the next column (Q) with values:
If cell A:1 = orange then cell Q:1 = eat
If cell A:1 = desk then cell Q:1 = write
If cell A:1 = Texas then cell Q:1 = live
If cell A:1 = red then cell Q:1 = see
If cell A:1 = hot then cell Q:1 = feel
If cell A:1 = shirt then cell Q:1 = wear
If cell A:1 = ring then cell Q:1 = wear
If cell A:1 = male then cell Q:1 = am
If cell A:1 = Thursday then cell Q:1 = is
If cell A:1 = Christmas then cell Q:1 = celebrate
If cell A:1 = dog then cell Q:1 = play
If cell A:1 = sad then cell Q:1 = cry
I need it to do this for P - AG (18 columns) and anywhere from 5,000 to 15,000 rows.
Again, I'm not sure how to take what I want to do and translate it into the code.
If you could show me a way to do this with the first two columns as I've detailed or point me in the direction of something or someone that would help me figure this out, I'd really appreciate it.
I'm just getting started with trying to write macros for Excel. I have minimal JavaScript knowledge, so I understand parts of it but I'm not totally sure of the correct language. I'm trying to create a macro that will reference another cell and add a value in a different cell based on what that cell says.
For example, the logic would be something similar to this:
If cell A:1 = orange then cell P:1 = fruit.
The complex part is that I need it to run through several checks before continuing onto the next cell in the column, so it would have to go through the following:
If cell A:1 = orange then cell P:1 = fruit
If cell A:1 = desk then cell P:1 = furniture
If cell A:1 = Texas then cell P:1 = state
If cell A:1 = red then cell P:1 = color
If cell A:1 = hot then cell P:1 = temperature
If cell A:1 = shirt then cell P:1 = clothing
If cell A:1 = ring then cell P:1 = jewelry
If cell A:1 = male then cell P:1 = gender
If cell A:1 = Thursday then cell P:1 = day
If cell A:1 = Christmas then cell P:1 = holiday
If cell A:1 = dog then cell P:1 = mammal
If cell A:1 = sad then cell P:1 = emotion
The macro would have to run through all of those checks for each cell clear down until there is a blank cell in column A. Once it reaches that point, it would need to go back to the top of column A and start doing the same thing to populate the next column (Q) with values:
If cell A:1 = orange then cell Q:1 = eat
If cell A:1 = desk then cell Q:1 = write
If cell A:1 = Texas then cell Q:1 = live
If cell A:1 = red then cell Q:1 = see
If cell A:1 = hot then cell Q:1 = feel
If cell A:1 = shirt then cell Q:1 = wear
If cell A:1 = ring then cell Q:1 = wear
If cell A:1 = male then cell Q:1 = am
If cell A:1 = Thursday then cell Q:1 = is
If cell A:1 = Christmas then cell Q:1 = celebrate
If cell A:1 = dog then cell Q:1 = play
If cell A:1 = sad then cell Q:1 = cry
I need it to do this for P - AG (18 columns) and anywhere from 5,000 to 15,000 rows.
Again, I'm not sure how to take what I want to do and translate it into the code.
If you could show me a way to do this with the first two columns as I've detailed or point me in the direction of something or someone that would help me figure this out, I'd really appreciate it.