View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cheryl Cheryl is offline
external usenet poster
 
Posts: 144
Default How to use combobox contents to get information for userform

Thank you all... I got this to work..

Private Sub cboBoxCustomer_Change()

Dim SourceRange As Range

Dim Val1 As String

Set SourceRange = Range(cboBoxCustomer.RowSource)

Val1 = cboBoxCustomer.Value

txtVendorID.Text = SourceRange.Offset(cboBoxCustomer.ListIndex, -2).Resize(1, 1).Value
txtType.Text = SourceRange.Offset(cboBoxCustomer.ListIndex, -1).Resize(1, 1).Value
txtName.Text = SourceRange.Offset(cboBoxCustomer.ListIndex, 0).Resize(1, 1).Value
txtDivision.Text = SourceRange.Offset(cboBoxCustomer.ListIndex, 1).Resize(1, 1).Value
txtAddress1.Text = SourceRange.Offset(cboBoxCustomer.ListIndex, 2).Resize(1, 1).Value

etc...

so it now fills in my form with the proper data based on the combo box selection... However... I need to use that information now.. to be able to update the record, once found.... Basically.. I am using the combobox to find the record.. that is tied to a worksheet... Now, I need to be able to update or delete that record based on a command button. I can't seem to make it update.... I think it is because I can't seem to get it to see the row that the found record is currently on to change it.

"dmang " wrote:

You could try using the FIND object in the combobox_click event

set rg = Worksheets(1).Range("a1:a500")
With rg 'look in column a for the va
Set c = .Find(combo1.text, lookin:=xlValues)
If Not c Is Nothing Then


End With


---
Message posted from http://www.ExcelForum.com/