VBA: Pull Record Into UserForm
From: Mcasteel (Mcasteel.1eqqu0_at_excelforum-nospam.com)
Date: 10/26/04
- Next message: Mcasteel: "VBA: Extracting Range from work*** and inserting into userform"
- Previous message: Bob Phillips: "Re: Formula for tickbox?!?"
- Next in thread: Bob Phillips: "Re: Pull Record Into UserForm"
- Reply: Bob Phillips: "Re: Pull Record Into UserForm"
- Reply: Dave Peterson: "Re: VBA: Pull Record Into UserForm"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 26 Oct 2004 10:51:22 -0500
I have a work*** full of Customer Information. A simplified record
would like somewhat like the following:
_*Lname,_Fname,_Mname,_SSN,_info1,_info2,_info3*_
I want to pull the customers LName, FName, SSN, and info into my form
based upon the customers SSN.
So the end user will type in the SSN, and all other cells associated
with that customer will be inserted into either txtboxes or labels on
the user form.
Im getting an error on the code I am working on and could use your
expertise.
_Here_is_the_code_I_have_so_far._
Private Sub cmdSelectRecord_Click()
Dim LName As String
Dim FName As String
Dim MName As String
Dim rngActive As Range
Set rngActive = Application.ActiveCell
Dim iRow As String
Dim CustSSN As String
'Fill variable with User Inputed Cust. SSN
CustSSN = txtCustSSN
iRow = WorksheetFunction.Match(CustSSN,
Worksheets("sheet1").Range("f27:f307"), 0)
If iRow = 0 Then
MsgBox "Customer SSN Was Not Found"
Else
MsgBox "Record Found."
'Move Customer info from Work*** to current form
'lblLName.caption = rngActive.offset(0, -3).value
'lblFName.caption = rngActive.offset(0, -2).Value
'lblMiddle.caption = rngActive.offset(0, -1).value
End If
End Sub
-- Mcasteel ------------------------------------------------------------------------ Mcasteel's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15698 View this thread: http://www.excelforum.com/showthread.php?threadid=272475
- Next message: Mcasteel: "VBA: Extracting Range from work*** and inserting into userform"
- Previous message: Bob Phillips: "Re: Formula for tickbox?!?"
- Next in thread: Bob Phillips: "Re: Pull Record Into UserForm"
- Reply: Bob Phillips: "Re: Pull Record Into UserForm"
- Reply: Dave Peterson: "Re: VBA: Pull Record Into UserForm"
- Messages sorted by: [ date ] [ thread ]