Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
accessnovice
 
Posts: n/a
Default automatically insert town name after entering zip code

I have created a sheet in which I am entering addresses. I created a drop
down list for the seven zip codes I am working with. Is there a way to have
excel automaticall y enter the corresponding town in the adjacent cell after
I choose a zip code?
  #2   Report Post  
Anne Troy
 
Posts: n/a
Default

Sure. You need a worksheet with the zips and towns listed on it, then you
can use a vlookup. See this for a tutorial:
http://www.officearticles.com/tutori...excel.htm#boss
*******************
~Anne Troy

www.OfficeArticles.com


"accessnovice" wrote in message
...
I have created a sheet in which I am entering addresses. I created a drop
down list for the seven zip codes I am working with. Is there a way to

have
excel automaticall y enter the corresponding town in the adjacent cell

after
I choose a zip code?



  #3   Report Post  
abcd
 
Posts: n/a
Default

Well it depends:

if it's a fixed cell, you may put a formula in the next cell
( a match / indirect couple OR a lookup function)

But you want this even with new lines, you'll need a vba code to
auto-add the new next-cell too:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then ' I suppose you enter zip in the column 3
Dim i&
On Error Resume Next
Application.EnableEvents = False
i = 0
' below I suppose all the known ZIP code are in the column A
' if unknown, match gives an error
' so i=0 because of "on error resume next"
i = Application.WorksheetFunction.Match(Target.Value, Range("A:A"), 1)
' below I suppose the associated Known City are in the B column
(column=2)
' and i suppose the city name must be on the right of the entered zip
code
If i 0 Then: Target.Offset(0, 1).Value = Cells(i, 2)
Application.EnableEvents = True

End If
End Sub


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
how do i automatically insert the current author's name in a cell. Nolin Excel Worksheet Functions 1 April 8th 05 04:38 AM
Insert date automatically Rick Excel Discussion (Misc queries) 2 March 31st 05 11:49 PM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
Function to automatically insert a new sheet as a result of data entry? Mark Mulik Excel Worksheet Functions 2 November 28th 04 02:21 AM
how do I get an invoice to automatically insert the next invoice . curse New Users to Excel 2 November 27th 04 02:23 AM


All times are GMT +1. The time now is 03:02 AM.

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

About Us

"It's about Microsoft Excel"