Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using a values from a lookup table to populate a range

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Using a values from a lookup table to populate a range

Sure.

The Source is the sample provided originally. It is a table of all states
and their acceptable zips, plus some other columns of data I do not need to
bring into the destination worksheet. It has a named range of Territory that
identifies the table range. Column A lists the State field, Columns B & C
have the Zips field. Their column headings are identical to the corresponding
column headings in the destination field (the data is just in a different
columnar order).

The destination will only have data for one State at a time. I have a
worksheet for each state, and I want to filter the Source for the matching
state of the desitination worksheet. For instance, FL has 3 valid rows of
data in Source. I want to copy the FL data for columns B & C to the
corresponding columns in the destination (D & E). Then last but not least,
in the destination worksheet, copy this range of values down to the end of
the destination table. So for FL destination worksheet, it would look like
this (FL has 3 valid rows of zips):

For instance, FL destination will look like this (simplified...alot of other
columns in reality):
Columns:
A B C D E
FL 1a NameA 33301 33999
FL 2a NameA 34401 34999
FL 3a NameA 35501 39999
FL 1b NameB 33301 33999
FL 2b NameB 34401 34999
FL 3b NameB 35501 39999
FL 1c NameC 33301 33999
FL 2c NameC 34401 34999
FL 3c NameC 35501 39999

The other states would have the same repeating pattern for the range of
valid zips for them. For instance: CA has only 2 valid zips. It would copy
the 2 valid rows/columns of zip data to the appropriate column (D & E in
destination example), then repeat the patten down to the end of the table.

For instance, CA destination will look like (simplified...alot of other
columns in reality):
Columns:
A B C D E
CA 1a NameA 47701 47999
CA 2a NameA 48222 48999
CA 1b NameB 47701 47999
CA 2b NameB 48222 48999
CA 1c NameC 47701 47999
CA 2c NameC 48222 48999
CA 1d NameD 47701 47999
CA 2d NameD 48222 48999

I hope that is more clear. Thanks for your consideration!

"Joel" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Using a values from a lookup table to populate a range

Jill and I have been working on this to no avail. Please help!

"VickiV" wrote:

Sure.

The Source is the sample provided originally. It is a table of all states
and their acceptable zips, plus some other columns of data I do not need to
bring into the destination worksheet. It has a named range of Territory that
identifies the table range. Column A lists the State field, Columns B & C
have the Zips field. Their column headings are identical to the corresponding
column headings in the destination field (the data is just in a different
columnar order).

The destination will only have data for one State at a time. I have a
worksheet for each state, and I want to filter the Source for the matching
state of the desitination worksheet. For instance, FL has 3 valid rows of
data in Source. I want to copy the FL data for columns B & C to the
corresponding columns in the destination (D & E). Then last but not least,
in the destination worksheet, copy this range of values down to the end of
the destination table. So for FL destination worksheet, it would look like
this (FL has 3 valid rows of zips):

For instance, FL destination will look like this (simplified...alot of other
columns in reality):
Columns:
A B C D E
FL 1a NameA 33301 33999
FL 2a NameA 34401 34999
FL 3a NameA 35501 39999
FL 1b NameB 33301 33999
FL 2b NameB 34401 34999
FL 3b NameB 35501 39999
FL 1c NameC 33301 33999
FL 2c NameC 34401 34999
FL 3c NameC 35501 39999

The other states would have the same repeating pattern for the range of
valid zips for them. For instance: CA has only 2 valid zips. It would copy
the 2 valid rows/columns of zip data to the appropriate column (D & E in
destination example), then repeat the patten down to the end of the table.

For instance, CA destination will look like (simplified...alot of other
columns in reality):
Columns:
A B C D E
CA 1a NameA 47701 47999
CA 2a NameA 48222 48999
CA 1b NameB 47701 47999
CA 2b NameB 48222 48999
CA 1c NameC 47701 47999
CA 2c NameC 48222 48999
CA 1d NameD 47701 47999
CA 2d NameD 48222 48999

I hope that is more clear. Thanks for your consideration!

"Joel" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Using a values from a lookup table to populate a range

I have a few questions

It look like you are sortine the destinations by name and number (1a, 2a,
3a...) where is the name a number coming from?

There si a website to get zipcodes. I wrote a macro last year for somebody
to get the names of the city from the zip code using this website. I can do
something similar if it helps.

Sub GetZipCodes()

ZIPCODE = InputBox("Enter 5 digit zipcode : ")

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://zip4.usps.com/zip4/citytown_zip.jsp"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4
DoEvents
Loop

Do While IE.busy = True
DoEvents
Loop
Set Form = IE.document.getElementsByTagname("Form")

Set zip5 = IE.document.getElementById("zip5")
zip5.Value = ZIPCODE

Form(0).Submit
Do While IE.busy = True
DoEvents
Loop

Set Table = IE.document.getElementsByTagname("Table")
If Table(0).Rows(0).innertext = "" Then
MsgBox ("Invalid Zip code")
Else
Location = Table(0).Rows(2).innertext
End If
IE.Quit
MsgBox ("Zip code = " & ZIPCODE & " City/State = " & Location)


End Sub





"VickiV" wrote:

Sure.

The Source is the sample provided originally. It is a table of all states
and their acceptable zips, plus some other columns of data I do not need to
bring into the destination worksheet. It has a named range of Territory that
identifies the table range. Column A lists the State field, Columns B & C
have the Zips field. Their column headings are identical to the corresponding
column headings in the destination field (the data is just in a different
columnar order).

The destination will only have data for one State at a time. I have a
worksheet for each state, and I want to filter the Source for the matching
state of the desitination worksheet. For instance, FL has 3 valid rows of
data in Source. I want to copy the FL data for columns B & C to the
corresponding columns in the destination (D & E). Then last but not least,
in the destination worksheet, copy this range of values down to the end of
the destination table. So for FL destination worksheet, it would look like
this (FL has 3 valid rows of zips):

For instance, FL destination will look like this (simplified...alot of other
columns in reality):
Columns:
A B C D E
FL 1a NameA 33301 33999
FL 2a NameA 34401 34999
FL 3a NameA 35501 39999
FL 1b NameB 33301 33999
FL 2b NameB 34401 34999
FL 3b NameB 35501 39999
FL 1c NameC 33301 33999
FL 2c NameC 34401 34999
FL 3c NameC 35501 39999

The other states would have the same repeating pattern for the range of
valid zips for them. For instance: CA has only 2 valid zips. It would copy
the 2 valid rows/columns of zip data to the appropriate column (D & E in
destination example), then repeat the patten down to the end of the table.

For instance, CA destination will look like (simplified...alot of other
columns in reality):
Columns:
A B C D E
CA 1a NameA 47701 47999
CA 2a NameA 48222 48999
CA 1b NameB 47701 47999
CA 2b NameB 48222 48999
CA 1c NameC 47701 47999
CA 2c NameC 48222 48999
CA 1d NameD 47701 47999
CA 2d NameD 48222 48999

I hope that is more clear. Thanks for your consideration!

"Joel" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Using a values from a lookup table to populate a range

Good questions. I cannot use standard zipcodes, as some of my ziphigh and
ziplow values are custom values rather than official zipcodes. And I am also
bringing in a Zipdefinition value from another column as well....so they are
all custom values.

The name and number fields come from a another source file called
StateAccounts. This StateAccounts source file lists the State (below example
is a StateAccounts file for FL), and unique Name and Account Number on each
row (see example):

State Name AccountNumber
FL Jill Acct1
FL Vicki Acct2
FL Paul Acct3
FL Vicki Acc4
FL Sam Acct5
FL Sam Acc6

I have to blow out the Name and Account Number field for each row of valid
zip values in the Zip Source file for FL. So in the end this StateAccount
source file which started with 6 rows, blows out to 18 rows (since FL has 3
rows of valid zip values)

I created a macro that inserts the number of rows for each Name/Account
combination needed to insert the 3 valid zip rows for FL. So my incomplete
StateAccount file now looks like:

State Name AccountNumber ZipLow ZipHigh ZipDefinition
FL Jill Acct1
FL Jill Acct1
FL Jill Acct1
FL Vicki Acct2
FL Vicki Acct2
FL Vicki Acct2
FL Paul Acct3
FL Paul Acct3
FL Paul Acct3
etc.....

Now I am trying to autopopulate the ZipHigh/ZipLow/ZipDefintion values for
FL throughout the worksheet using the zip source file from original posting.

I thought this would be the easiest way to build the final StateAccount
file...please share your thoughts.

"Joel" wrote:

I have a few questions

It look like you are sortine the destinations by name and number (1a, 2a,
3a...) where is the name a number coming from?

There si a website to get zipcodes. I wrote a macro last year for somebody
to get the names of the city from the zip code using this website. I can do
something similar if it helps.

Sub GetZipCodes()

ZIPCODE = InputBox("Enter 5 digit zipcode : ")

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://zip4.usps.com/zip4/citytown_zip.jsp"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4
DoEvents
Loop

Do While IE.busy = True
DoEvents
Loop
Set Form = IE.document.getElementsByTagname("Form")

Set zip5 = IE.document.getElementById("zip5")
zip5.Value = ZIPCODE

Form(0).Submit
Do While IE.busy = True
DoEvents
Loop

Set Table = IE.document.getElementsByTagname("Table")
If Table(0).Rows(0).innertext = "" Then
MsgBox ("Invalid Zip code")
Else
Location = Table(0).Rows(2).innertext
End If
IE.Quit
MsgBox ("Zip code = " & ZIPCODE & " City/State = " & Location)


End Sub





"VickiV" wrote:

Sure.

The Source is the sample provided originally. It is a table of all states
and their acceptable zips, plus some other columns of data I do not need to
bring into the destination worksheet. It has a named range of Territory that
identifies the table range. Column A lists the State field, Columns B & C
have the Zips field. Their column headings are identical to the corresponding
column headings in the destination field (the data is just in a different
columnar order).

The destination will only have data for one State at a time. I have a
worksheet for each state, and I want to filter the Source for the matching
state of the desitination worksheet. For instance, FL has 3 valid rows of
data in Source. I want to copy the FL data for columns B & C to the
corresponding columns in the destination (D & E). Then last but not least,
in the destination worksheet, copy this range of values down to the end of
the destination table. So for FL destination worksheet, it would look like
this (FL has 3 valid rows of zips):

For instance, FL destination will look like this (simplified...alot of other
columns in reality):
Columns:
A B C D E
FL 1a NameA 33301 33999
FL 2a NameA 34401 34999
FL 3a NameA 35501 39999
FL 1b NameB 33301 33999
FL 2b NameB 34401 34999
FL 3b NameB 35501 39999
FL 1c NameC 33301 33999
FL 2c NameC 34401 34999
FL 3c NameC 35501 39999

The other states would have the same repeating pattern for the range of
valid zips for them. For instance: CA has only 2 valid zips. It would copy
the 2 valid rows/columns of zip data to the appropriate column (D & E in
destination example), then repeat the patten down to the end of the table.

For instance, CA destination will look like (simplified...alot of other
columns in reality):
Columns:
A B C D E
CA 1a NameA 47701 47999
CA 2a NameA 48222 48999
CA 1b NameB 47701 47999
CA 2b NameB 48222 48999
CA 1c NameC 47701 47999
CA 2c NameC 48222 48999
CA 1d NameD 47701 47999
CA 2d NameD 48222 48999

I hope that is more clear. Thanks for your consideration!

"Joel" wrote:

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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Using a values from a lookup table to populate a range

try this code. You need to change the two SET stements on the top of the
code to match your workbook and worksheet. I also don't know where the Zip
Definition is coming from.


Sub GetZipcodes()

Set LookupSht = Thisworkbook.Sheets("Sheet1")
Set ResultSht = Thisworkbook.Sheets("Sheet2")

State = ResultSht.Range("A2")
'Find State on LookupSht
With LookupSht
Set c = .Columns("A").Find(what:=State, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Cannot find State : " & State)
Else
'find number of rows for state
LastRow = c.Row
Do While .Range("A" & (LastRow + 1)) = State And _
LastRow <= Rows.Count

LastRow = LastRow + 1
Loop
NumRows = LastRow - c.Row + 1
Set CopyRange = .Range("B" & c.Row & ":C" & LastRow)

End If
End With


RowCount = 2
StartRow = RowCount
With ResultSht
Do While Range("B" & RowCount) < ""
'wait until last row of Name before doing the copy
If Range("B" & RowCount) < Range("B" & (RowCount + 1)) Then
If (RowCount - StartRow + 1) < NumRows Then
Name = .Range("B" & RowCount)
MsgBox ("Error in " & Name & " Acount. Number of Rows don't
match")
Else
CopyRange.Copy Destination:=.Range("D" & StartRow)
StartRow = RowCount + 1
End If
End If
RowCount = RowCount + 1
Loop
End With


End Sub


"VickiV" wrote:

Good questions. I cannot use standard zipcodes, as some of my ziphigh and
ziplow values are custom values rather than official zipcodes. And I am also
bringing in a Zipdefinition value from another column as well....so they are
all custom values.

The name and number fields come from a another source file called
StateAccounts. This StateAccounts source file lists the State (below example
is a StateAccounts file for FL), and unique Name and Account Number on each
row (see example):

State Name AccountNumber
FL Jill Acct1
FL Vicki Acct2
FL Paul Acct3
FL Vicki Acc4
FL Sam Acct5
FL Sam Acc6

I have to blow out the Name and Account Number field for each row of valid
zip values in the Zip Source file for FL. So in the end this StateAccount
source file which started with 6 rows, blows out to 18 rows (since FL has 3
rows of valid zip values)

I created a macro that inserts the number of rows for each Name/Account
combination needed to insert the 3 valid zip rows for FL. So my incomplete
StateAccount file now looks like:

State Name AccountNumber ZipLow ZipHigh ZipDefinition
FL Jill Acct1
FL Jill Acct1
FL Jill Acct1
FL Vicki Acct2
FL Vicki Acct2
FL Vicki Acct2
FL Paul Acct3
FL Paul Acct3
FL Paul Acct3
etc.....

Now I am trying to autopopulate the ZipHigh/ZipLow/ZipDefintion values for
FL throughout the worksheet using the zip source file from original posting.

I thought this would be the easiest way to build the final StateAccount
file...please share your thoughts.

"Joel" wrote:

I have a few questions

It look like you are sortine the destinations by name and number (1a, 2a,
3a...) where is the name a number coming from?

There si a website to get zipcodes. I wrote a macro last year for somebody
to get the names of the city from the zip code using this website. I can do
something similar if it helps.

Sub GetZipCodes()

ZIPCODE = InputBox("Enter 5 digit zipcode : ")

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://zip4.usps.com/zip4/citytown_zip.jsp"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4
DoEvents
Loop

Do While IE.busy = True
DoEvents
Loop
Set Form = IE.document.getElementsByTagname("Form")

Set zip5 = IE.document.getElementById("zip5")
zip5.Value = ZIPCODE

Form(0).Submit
Do While IE.busy = True
DoEvents
Loop

Set Table = IE.document.getElementsByTagname("Table")
If Table(0).Rows(0).innertext = "" Then
MsgBox ("Invalid Zip code")
Else
Location = Table(0).Rows(2).innertext
End If
IE.Quit
MsgBox ("Zip code = " & ZIPCODE & " City/State = " & Location)


End Sub





"VickiV" wrote:

Sure.

The Source is the sample provided originally. It is a table of all states
and their acceptable zips, plus some other columns of data I do not need to
bring into the destination worksheet. It has a named range of Territory that
identifies the table range. Column A lists the State field, Columns B & C
have the Zips field. Their column headings are identical to the corresponding
column headings in the destination field (the data is just in a different
columnar order).

The destination will only have data for one State at a time. I have a
worksheet for each state, and I want to filter the Source for the matching
state of the desitination worksheet. For instance, FL has 3 valid rows of
data in Source. I want to copy the FL data for columns B & C to the
corresponding columns in the destination (D & E). Then last but not least,
in the destination worksheet, copy this range of values down to the end of
the destination table. So for FL destination worksheet, it would look like
this (FL has 3 valid rows of zips):

For instance, FL destination will look like this (simplified...alot of other
columns in reality):
Columns:
A B C D E
FL 1a NameA 33301 33999
FL 2a NameA 34401 34999
FL 3a NameA 35501 39999
FL 1b NameB 33301 33999
FL 2b NameB 34401 34999
FL 3b NameB 35501 39999
FL 1c NameC 33301 33999
FL 2c NameC 34401 34999
FL 3c NameC 35501 39999

The other states would have the same repeating pattern for the range of
valid zips for them. For instance: CA has only 2 valid zips. It would copy
the 2 valid rows/columns of zip data to the appropriate column (D & E in
destination example), then repeat the patten down to the end of the table.

For instance, CA destination will look like (simplified...alot of other
columns in reality):
Columns:
A B C D E
CA 1a NameA 47701 47999
CA 2a NameA 48222 48999
CA 1b NameB 47701 47999
CA 2b NameB 48222 48999
CA 1c NameC 47701 47999
CA 2c NameC 48222 48999
CA 1d NameD 47701 47999
CA 2d NameD 48222 48999

I hope that is more clear. Thanks for your consideration!

"Joel" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a table with a dynamic range Jeff Excel Worksheet Functions 3 February 22nd 07 06:47 AM
How do I use LOOKUP to return a range of values, then SUM values? irvine79 Excel Worksheet Functions 5 August 4th 06 01:33 PM
Lookup Values in Table Steve Excel Worksheet Functions 2 March 24th 06 02:04 PM
Can Excel calculate populate table using row/column values & calc's on other sheet? wildswing Excel Discussion (Misc queries) 1 January 26th 06 06:18 AM
Need Help with lookup values in Table cank Excel Discussion (Misc queries) 4 November 10th 05 05:40 PM


All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"