ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro trigger? (https://www.excelbanter.com/excel-programming/292950-re-macro-trigger.html)

excelguru

Macro trigger?
 
You could do it with VBA, but I don't feel like trying to create the code.

The quickest and most straightforward way would be to place nested IF and
VLOOKUP formulas into the I, J, and K columns, especially since you already
have a table of letter/value assignments on another sheet in the same file.

For example, Cell I2 contains:

=IF($F2="",0,VLOOKUP($F2,'Sheet2'!$A$1:$B$26,2))

This assumes that your table of values is on Sheet2 in the range A1 to B26,
with the code letters in column A (in alphabetical order) and the values in
column B.

This formula will return a value of 0 (zero) until a letter is typed into
the F column. The formula above only needs to be typed once into cell I2.
You can then drag-copy the formula across cells J2 and K2. Then select all
three cells and drag-copy the formula down the sheet as far as you need. The
columnar F reference will remain locked when dragging sideways, but the row
references will change as you drag down.

Hope this helps.

"trot4 " wrote in message
...
If anyone can help me on this one, it would be much appreciated. I want
to be able to type a letter in a cell and have it automatically execute
some action. More specifically, I have letter codes I will be entering
into column F.

For example, I would like to be able to enter the letter "B" into F2
and have excel place values of 10,000,000 in cells I2 and J2
automatically. Or another case would be entering the letter "A" in F3
and have excel place values of 15,000,000 in I3, J3, and K3.

The code "B" would always need the value placed in the 2 cells starting
3 columns to the right of where the code is input. Likewise, "A" would
always need the associated value placed in the 3 cells starting 3
columns to the right of the input cell and so on.

I already have tables of the codes and what values they represent on
another worksheet. I just need to be able to take those values and have
excel place them in the designated cells automatically upon entering
the code.

I hope I explained what it is I wish to accomplish. Thanks again.

Trot


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com