B
BernzG
Hi,
Trying to resolve a problem when trying to populate TextBox field
after data has been entered into TextBox1 field in a Userform.
The data entered in TextBox1 is a date dd/mm/yyyy and is stored i
sheet Dbase as "Text" ( have tried many different options Date
General, Text ) but continue to either not match it or get erro
messages "Type mismatch Error 13 at code Loc = TextBox1.Value )
My code is as follows : ( any suggestions )
Private Sub TextBox1_AfterUpdate()
Dim Loc As Long
Sheets("Menu").Select
res = Application.Match(TextBox1.Value
Worksheets("Dbase").Range("A:A"), 0)
If IsError(res) Then
Exit Sub
Else
End If
Loc = TextBox1.Value
With Worksheets("Dbase")
Set C = .Range("A:A").Find(Loc, LookIn:=xlValues)
TextBox2 = .Cells(C.Row, 2)
TextBox4 = .Cells(C.Row, 3)
TextBox5 = .Cells(C.Row, 4)
TextBox6 = .Cells(C.Row, 5)
TextBox7 = .Cells(C.Row, 6)
TextBox8 = .Cells(C.Row, 7)
TextBox9 = .Cells(C.Row, 8)
TextBox10 = .Cells(C.Row, 9)
TextBox11 = .Cells(C.Row, 10)
TextBox13 = .Cells(C.Row, 12)
If .Cells(C.Row, 11) = "F" Then
OptionButton2.Value = True
OptionButton3.Value = False
Else
OptionButton3.Value = True
OptionButton2.Value = False
End If
End With
End Sub
Cheers,
Bern
Trying to resolve a problem when trying to populate TextBox field
after data has been entered into TextBox1 field in a Userform.
The data entered in TextBox1 is a date dd/mm/yyyy and is stored i
sheet Dbase as "Text" ( have tried many different options Date
General, Text ) but continue to either not match it or get erro
messages "Type mismatch Error 13 at code Loc = TextBox1.Value )
My code is as follows : ( any suggestions )
Private Sub TextBox1_AfterUpdate()
Dim Loc As Long
Sheets("Menu").Select
res = Application.Match(TextBox1.Value
Worksheets("Dbase").Range("A:A"), 0)
If IsError(res) Then
Exit Sub
Else
End If
Loc = TextBox1.Value
With Worksheets("Dbase")
Set C = .Range("A:A").Find(Loc, LookIn:=xlValues)
TextBox2 = .Cells(C.Row, 2)
TextBox4 = .Cells(C.Row, 3)
TextBox5 = .Cells(C.Row, 4)
TextBox6 = .Cells(C.Row, 5)
TextBox7 = .Cells(C.Row, 6)
TextBox8 = .Cells(C.Row, 7)
TextBox9 = .Cells(C.Row, 8)
TextBox10 = .Cells(C.Row, 9)
TextBox11 = .Cells(C.Row, 10)
TextBox13 = .Cells(C.Row, 12)
If .Cells(C.Row, 11) = "F" Then
OptionButton2.Value = True
OptionButton3.Value = False
Else
OptionButton3.Value = True
OptionButton2.Value = False
End If
End With
End Sub
Cheers,
Bern