raylward102
11-09-2010, 04:05 PM
I have the code below. I've used it in another workbook userform successfully but it errors on
strFullAddress = .Address
Anyone see what the problem is? I'm losing it!
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Dim rngCell As Range
Dim strFullAddress As String
Set rngCell = Cells.Find(What:=UserForm1.ComboBox1.Value, After:=Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
With rngCell
strFullAddress = .Address
End With
a = Sheets("sheet1").Range(strFullAddress).Row
TextBox1.Text = Sheets("sheet1").Range("a" & a).Value
ComboBox2.Text = Sheets("sheet1").Range("c" & a).Value
ComboBox3.Text = Sheets("sheet1").Range("d" & a).Value
ComboBox4.Text = Sheets("sheet1").Range("e" & a).Value
ComboBox5.Text = Sheets("sheet1").Range("f" & a).Value
ComboBox6.Text = Sheets("sheet1").Range("h" & a).Value
ComboBox7.Text = Sheets("sheet1").Range("j" & a).Value
TextBox3.Text = Sheets("sheet1").Range("l" & a).Value
End If
End Sub
strFullAddress = .Address
Anyone see what the problem is? I'm losing it!
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Dim rngCell As Range
Dim strFullAddress As String
Set rngCell = Cells.Find(What:=UserForm1.ComboBox1.Value, After:=Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
With rngCell
strFullAddress = .Address
End With
a = Sheets("sheet1").Range(strFullAddress).Row
TextBox1.Text = Sheets("sheet1").Range("a" & a).Value
ComboBox2.Text = Sheets("sheet1").Range("c" & a).Value
ComboBox3.Text = Sheets("sheet1").Range("d" & a).Value
ComboBox4.Text = Sheets("sheet1").Range("e" & a).Value
ComboBox5.Text = Sheets("sheet1").Range("f" & a).Value
ComboBox6.Text = Sheets("sheet1").Range("h" & a).Value
ComboBox7.Text = Sheets("sheet1").Range("j" & a).Value
TextBox3.Text = Sheets("sheet1").Range("l" & a).Value
End If
End Sub