Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Look Up Box In a User Form

Hi,
I have created a user form for a spreadsheet solution, when opened it
provides various functions for handling data and exporting it to other
workbooks etc,
I am however stuck on one aspect of the form, I have a sheet titled 'Lookup'
On it I have in column (A) a list of Councils, in column (B) is the council
area code,
On my user form I have a combo box which is to be used to look up the
council name, next to it I have another text box in which I want to display
the area code for the selected council, at present I can get the combo box to
show the council and its area code when you scroll down the list, however
when you select a particular council it just shows the area code in the combo
box and nothing in the other text box next to it,
Can anyone help€¦€¦€¦€¦€¦€¦€¦€¦.

Regards
JTH

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Look Up Box In a User Form

Try something along these lines.

Private Sub ComboBox1_Change()

If ComboBox1 < "" Then

TextBox1.Value = Excel.WorksheetFunction.VLookup(ComboBox1.Value,
Sheets("lookup").Range("A1:B65536"), 2, False)

End If


End Sub

anyways if the value is not there, it will probably give you a #num# value.
But I imagine you are populating the combobox with the data in column A.

Cheers,

Scott

"JohnnyTheAmmer" wrote:

Hi,
I have created a user form for a spreadsheet solution, when opened it
provides various functions for handling data and exporting it to other
workbooks etc,
I am however stuck on one aspect of the form, I have a sheet titled 'Lookup'
On it I have in column (A) a list of Councils, in column (B) is the council
area code,
On my user form I have a combo box which is to be used to look up the
council name, next to it I have another text box in which I want to display
the area code for the selected council, at present I can get the combo box to
show the council and its area code when you scroll down the list, however
when you select a particular council it just shows the area code in the combo
box and nothing in the other text box next to it,
Can anyone help€¦€¦€¦€¦€¦€¦€¦€¦.

Regards
JTH

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Look Up Box In a User Form

Scott

Many Thanks, a little tweaking got that up and running

Cheers

JTH

"Scott" wrote:

Try something along these lines.

Private Sub ComboBox1_Change()

If ComboBox1 < "" Then

TextBox1.Value = Excel.WorksheetFunction.VLookup(ComboBox1.Value,
Sheets("lookup").Range("A1:B65536"), 2, False)

End If


End Sub

anyways if the value is not there, it will probably give you a #num# value.
But I imagine you are populating the combobox with the data in column A.

Cheers,

Scott

"JohnnyTheAmmer" wrote:

Hi,
I have created a user form for a spreadsheet solution, when opened it
provides various functions for handling data and exporting it to other
workbooks etc,
I am however stuck on one aspect of the form, I have a sheet titled 'Lookup'
On it I have in column (A) a list of Councils, in column (B) is the council
area code,
On my user form I have a combo box which is to be used to look up the
council name, next to it I have another text box in which I want to display
the area code for the selected council, at present I can get the combo box to
show the council and its area code when you scroll down the list, however
when you select a particular council it just shows the area code in the combo
box and nothing in the other text box next to it,
Can anyone help€¦€¦€¦€¦€¦€¦€¦€¦.

Regards
JTH

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 fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
user form Bill[_19_] Excel Programming 0 October 23rd 03 04:32 AM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM


All times are GMT +1. The time now is 06:32 PM.

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"