The find function

A

Albert

Hi Guys,

I got the following code

Sub message()
Dim Response As Integer
Dim destWB1 As Workbook

Response = MsgBox("Has the customer called in before?", vbQuestion +
vbYesNo, "")

If Response = vbYes Then
Set destWB1 = Workbooks.Open("K:\Customer services screen\Test Database\Test
DB.xlsm")
'destWB1.Sheets("Sheet1").Activate

Dim myC As Range
Set myC = Worksheets("Sheet1").Range("A:A").Find(TxtIDnumber.Text)
If myC Is Nothing Then
MsgBox frmCustomerService.TxtIDnumber.Text & " was not found."
FrameContact.Visible = True
TextNotesview.Visible = False
LabelNotesview.Visible = False
ActiveCell.Offset(0, 5) = "Called in before"
DTPicker2.Value = CVar(Date)
' frmCustomerService.DTPicker2.Value = CVar(Date)
Else

FrameContact.Visible = True
frmCustomerService.TextBoxSpoketo.Text = myC(1, 3).Value 'Pick up
the cell to the right of the ID#
frmCustomerService.DTPicker2.Value = myC(1, 2).Value 'Pick up the
cell two to the right of the ID#
frmCustomerService.TextBoxOutcome.Text = myC(1, 10).Value
frmCustomerService.TextNotesview.Text = myC(1, 12).Value

End If

ElseIf Response = vbNo Then
' myC(1, 6).Value = "No"
ActiveCell.Offset(0, 5) = "No"
FrameContact.Visible = False
End If
destWB1.Close
End Sub

I can't get to find the textbox value eventhough I know it's in the workbook.

Please help?

Thanks
Albert
 
J

Joel

You may need lookin and lookat
Set myC = Worksheets("Sheet1").Range("A:A").Find( _
what:=TxtIDnumber.Text, _
lookin:=xlvalues, _
lookat:=xlwhole)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top