View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Using a values from a lookup table to populate a range

Can you give examples of the data in both workbooks. I'm not sure from yor
example if the table you provided is the source or the destination data.

"Jill Smith" wrote:

Hi-
I really need some input on this one. I have a lookup table that identifies
valid zipcodes for states/provinces. What I need is to create a macro that
helps poplulate a number of worksheets with the valid zipcodes for the
identified state.

For instance: My Lookup Table (in a separate file) has the valid ZipLow and
ZipHighs for each state (see sample below). I have a macro that lookups the
state and inserts the number of rows necessary for each state (as they vary
per state) which gives me a good table to work with. Then I would like to
populate the ZipHigh and ZipLow columns based on the State column value until
the table is filled with appropriate zips for each state in my table. I
would imagine the easiest way to do this would be to see the value in the
state column, then review the lookup table to copy in the range that is equal
to the state value, then repeat for each new state found. I am confused
about how to copy in the dynamic range from the lookup table, which would
vary depending on the state.

Sample lookup table:

State ZipLow ZipHigh
FL 33301 33999
FL 34401 34999
FL 35501 35999
CA 47701 47999
CA 48222 48999
MI 60001 60999

Thank you so much,
Jill