Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default using a list box to fill text boxes

Hi,

I have a form with 2 combo boxes and 1 list box that I would like to use to
automatically fill in numerous text boxes. The first combo box is the sheet
(and stored in variable myUnit for other uses) and the second is the column
(stored in myColumn also) and these generate the list box.

When someone clicks on an item in the list box I need to get more
information from that row and show them in the text boxes on the other side.
I am new at this and nothing seems to be working and appreciate your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default using a list box to fill text boxes

I'm not quite sure how you've got your data setup but this should get you the
general idea.
Private Sub ListBox1_Click
Dim SelectCell As Range
Const oSet As Long = 0 'Offset that determines how what row to start on
Set SelectCell = Cells(ListBox1.ListIndex + oSet, myColumn)
TextBox1.Text = SelectCell
TextBox2.Text = SelectCell.Offset(,1) 'Cell to the right of SelectCell
TextBox3.Text = SelectCell.Offset(,-1) 'Cell to the left of SelectCell
End Sub

Post back if you need more help
--
Charles Chickering

"A good example is twice the value of good advice."


"Jim T." wrote:

Hi,

I have a form with 2 combo boxes and 1 list box that I would like to use to
automatically fill in numerous text boxes. The first combo box is the sheet
(and stored in variable myUnit for other uses) and the second is the column
(stored in myColumn also) and these generate the list box.

When someone clicks on an item in the list box I need to get more
information from that row and show them in the text boxes on the other side.
I am new at this and nothing seems to be working and appreciate your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default using a list box to fill text boxes

Unfortunately I do not know what column they will be starting on as that is
the second combo box option. Once it is updated the list box then fills in
with all the values in that column that are not null.

I am also getting a run time error 13 €“ type mismatch message on the €śSet
SelectCell€ť line.


"Charles Chickering" wrote:

I'm not quite sure how you've got your data setup but this should get you the
general idea.
Private Sub ListBox1_Click
Dim SelectCell As Range
Const oSet As Long = 0 'Offset that determines how what row to start on
Set SelectCell = Cells(ListBox1.ListIndex + oSet, myColumn)
TextBox1.Text = SelectCell
TextBox2.Text = SelectCell.Offset(,1) 'Cell to the right of SelectCell
TextBox3.Text = SelectCell.Offset(,-1) 'Cell to the left of SelectCell
End Sub

Post back if you need more help
--
Charles Chickering

"A good example is twice the value of good advice."


"Jim T." wrote:

Hi,

I have a form with 2 combo boxes and 1 list box that I would like to use to
automatically fill in numerous text boxes. The first combo box is the sheet
(and stored in variable myUnit for other uses) and the second is the column
(stored in myColumn also) and these generate the list box.

When someone clicks on an item in the list box I need to get more
information from that row and show them in the text boxes on the other side.
I am new at this and nothing seems to be working and appreciate your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default using a list box to fill text boxes

Are all the listings unique? Are there any blank rows in the data?
--
Charles Chickering

"A good example is twice the value of good advice."


"Jim T." wrote:

Unfortunately I do not know what column they will be starting on as that is
the second combo box option. Once it is updated the list box then fills in
with all the values in that column that are not null.

I am also getting a run time error 13 €“ type mismatch message on the €śSet
SelectCell€ť line.


"Charles Chickering" wrote:

I'm not quite sure how you've got your data setup but this should get you the
general idea.
Private Sub ListBox1_Click
Dim SelectCell As Range
Const oSet As Long = 0 'Offset that determines how what row to start on
Set SelectCell = Cells(ListBox1.ListIndex + oSet, myColumn)
TextBox1.Text = SelectCell
TextBox2.Text = SelectCell.Offset(,1) 'Cell to the right of SelectCell
TextBox3.Text = SelectCell.Offset(,-1) 'Cell to the left of SelectCell
End Sub

Post back if you need more help
--
Charles Chickering

"A good example is twice the value of good advice."


"Jim T." wrote:

Hi,

I have a form with 2 combo boxes and 1 list box that I would like to use to
automatically fill in numerous text boxes. The first combo box is the sheet
(and stored in variable myUnit for other uses) and the second is the column
(stored in myColumn also) and these generate the list box.

When someone clicks on an item in the list box I need to get more
information from that row and show them in the text boxes on the other side.
I am new at this and nothing seems to be working and appreciate your help.

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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Adding custom list and text boxes to the custom tool bar from Excel C API Mousam Excel Discussion (Misc queries) 0 August 7th 07 09:19 AM
Selecting subsets using combo boxes or list boxes CLamar Excel Discussion (Misc queries) 0 June 1st 06 07:43 PM
Questions on combo boxes and list boxes. Marc New Users to Excel 1 March 14th 06 09:40 AM
Auto fill text boxes in user form by inputting data in another Finny33 Excel Programming 1 September 13th 04 12:53 PM


All times are GMT +1. The time now is 05:25 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"