hey.
I have this code, and when i run it, I get a msg "Method 'Range' of object '_Worksheet' failed"
in that range
I have this code, and when i run it, I get a msg "Method 'Range' of object '_Worksheet' failed"
in that range
Code:
Set rSearch1 = Sheet1.Range("B7", Range("B65536").End(xlUp))
the full code, here
Code:
Private Sub ComboBox8_Change()
Dim strFind1 As String 'what to find
Dim rSearch1, c As Range 'range to search
Set rSearch1 = Sheet1.Range("B7", Range("B65536").End(xlUp))
strFind1 = Me.ComboBox8.Value 'what to look for
With rSearch1
Set c = .Find(strFind1, LookIn:=xlValues)
If Not c Is Nothing Then
c.Select
With Me 'load entry to form
.ComboBox2.Value = c.Offset(0, 1).Value
.TextBox1.Value = c.Offset(0, 2).Value
.TextBox3.Value = c.Offset(0, 3).Value
.TextBox4.Value = c.Offset(0, 4).Value
.TextBox8.Value = c.Offset(0, 5).Value
.TextBox5.Value = c.Offset(0, 6).Value
.ComboBox3.Value = c.Offset(0, 7).Value
.TextBox9.Value = c.Offset(0, 8).Value
.ComboBox4.Value = c.Offset(0, 9).Value
.TextBox10.Value = c.Offset(0, 10).Value
.ComboBox5.Value = c.Offset(0, 11).Value
.ComboBox7.Value = c.Offset(0, 12).Value
.TextBox2.Value = c.Offset(0, 13).Value
.TextBox6.Value = c.Offset(0, 14).Value
.TextBox7.Value = c.Offset(0, 15).Value
.ComboBox6.Value = c.Offset(0, 16).Value
.cmbAmend.Enabled = True 'allow amendment or
.cmbDelete.Enabled = True 'allow record deletion
.cmbAdd.Enabled = False 'don't want to duplicate record
.cmbOk.Enabled = False
' .ComboBox8.SetFocus
End With
If tgl1.Caption = "New" Then
ComboBox8.SetFocus
Else
ComboBox6.SetFocus
End If
Else: MsgBox strFind1 & " not listed" 'search failed
ComboBox8.SetFocus
End If
End With
End Sub
I'm not sure what I'm missing. Seems like it should be a simple problem, but I can't seem to find it.
Thanks for all your help.
Thanks for all your help.