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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro - Fill in Field 1

Status
Not open for further replies.

dhrehor

IS-IT--Management
Jun 16, 2005
23
US
I am trying to create a macro to do the following on an Excel Spreadsheet

On Page 2 would be a permanent list of two Columns

Client ID Client Name


On page 1 I would like to be able to type or paste a client ID in one column and then have it autopopulate the column after it with the client name associated with the Client ID from page 2.

Is this possible?

Thanks

Don



 

Don,

Do you want the return value ALWAYS returned to the same cell or do you want the return value appended to the bottom of some list?

Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
Ok, have changed the parameters a little bit. I would rather do it this way.

Sheet 1

two columns

Customer # Customer Name

I will fill in the customer number and I want the spreadsheet to query a Microsoft Access Database that has all my customer #'s and Names (i.e. Field 1, Field 2) and then populate the appropriate customer name in the customer name field on the spreadsheet.

Thanks

Don
 
This could be an MS Query parameter query.

You enter the cust nbr in A2 and the customer name is returned to B2.

select B2

Data/Get external data/New database query - MS Access files - YOUR DATABASE - YOUR TABLE... select the customer name field -- select the edit query option and [finish]

in the query grid add a criteria for cust nbr. In the Criteria value, enter [What Cust Nbr?]

Edit/Return data to Excel. Before completing, select Edit Parameters. Select the THIRD OPTION, A2 reference in the Textbox, and refresh on change checkbox.

VOLA!



Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
Any this can be recorded as a macro, yes?
 


Why? Once you have your query table embedded (doing the above procedure) then it's there until you delete it.

Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
We have an app here that will export some data to an excel spreadsheet. Unfortunately it leaves a blank in the column for customer name, but it does populate the customer number in the column following the name.

So it creates a new spreadsheet everytime your export this report. I need it to populate the customer name from the customer number everytime I export the data.

hope that makes sense
 
It does NOT make sense.

"...it leaves a blank in the column for customer name."

lease post the SQL (copy 'n' paste). Data/Edit Query/SQL

Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
do you have an email address I can send you a sample spreadsheet and database? I do not see a way to attach here
 

ii36250 at bellhelicopter dot textron dot com

Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top