Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Macro to Program Cell Value based on another cell

Status
Not open for further replies.

Pistol

MIS
Jan 29, 2001
59
0
0
US
I'm not sure where to get started on this, but this is what I would like:

If cell (X3) contains VT, or, NY, or, NJ, or PA,... then Cell (T3) is NE

If cell (X3) contains GA, or, FL, or, AL, or PA,... then Cell T3 is SE

et cetera.

I need to determine a Region based on the value of a state listed in another cell.

I need the macro to search through 6K rows before stopping, and I am lost with ideas. Do you have any suggestions?

Thanks in advance,

Pistol
 
Easiest way is to use VLOOKUP. The macro can fill column T with formulas then copy and paste special values and you're done.

BTW, which is it for PA? NE or SE?
 
You shouldn't need VBA for this one. Just set up a table on another sheet listing each state in column A and the associated region in column B. Name this something like 'RegionKey', then use VLOOKUP formulas on your main sheet to look up the correct region for each row.

So the formula for Y3 (if column Y is where you want the region) would be:

=VLOOKUP(X3, RegionKey, 2)

VBAjedi [swords]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top