LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Userform - Query Help Please

I have a combobox on a user form populated with a list of data from sheet 1
of my workbook. The list contains approx 200 rows of data across 20 columns.

When the user makes a selection from the combobox a number of textboxes on
the userform are populated with data from the selected row.

The user is able to amend or update the data and it is then written back to
the sheet using a button control.
I am using the code listed below to populate the textboxes.

Private Sub Comboviewer2_Change()
Dim RowRange As Range
Set RowRange = Range("workpackages").Rows _
(Me.Comboviewer2.ListIndex + 1)

If Me.Comboviewer2.ListIndex < -1 Then
With Sheet1
..TextBox1.Text = RowRange.Columns(16).Value
..TextBox6.Text = RowRange.Columns(1).Value
..TextBox2.Text = RowRange.Columns(3).Value
..Tbox8.Text = RowRange.Columns(5).Value

My problem is as follows:
I want to be able to populate the combobox with only selected items from the
list of data on sheet1 -
e.g - only items where a particular column is empty or contains a date.

I am using the code below which populates the combobox as required.

I cannot figure out however how to populate the textboxes on the userform
with data from the row selected in the combobox or how to write the data from
the textboxes back to sheet1. The listindex code I was using previously does
not seem to work??

Thanks for any help or advice.

Regards

Mark

Private Sub UserForm_Initialize()
Dim rng As Range
Dim irow As Integer
Dim iCt As Integer
Dim c As Range
irow = Sheets("sheet1").Range("A1").End(xlDown).Row
Set rng = Sheets("sheet1").Range("A2:A" & irow)
For Each c In rng
If c.Offset(0, 8) < "" And c.Offset(0, 9) = "" Then
iCt = iCt + 1
With Me.Comboviewer2
AddItem c
End If
Next c
End With
End Sub


 
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
Another UserForm query Phil1982 Excel Programming 1 March 16th 06 10:21 PM
Another UserForm query Phil1982 Excel Programming 1 March 16th 06 02:01 PM
Query Results to UserForm Noel Excel Programming 1 September 29th 04 07:09 PM
Userform text box query?? dude Excel Programming 0 September 22nd 04 07:43 PM
Userform text box query?? MDL2004 Excel Programming 0 September 22nd 04 02:41 PM


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