LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
MP MP is offline
external usenet poster
 
Posts: 39
Default Find record by multi criteria in userform

I'm using a find button in my userform to extract data in the worksheet row
by account name and pull the data into the userform. However, if there
muliple accounts with the same name the data will not pull correclty.

Is there a way I can modify the below code so the find button will pull the
information by the account name and matching file number associated with the
account name. I assigned each account name with a unique file ID number in a
separate column. The properties name for the unique file ID num is filenum.
Thanks

Code:
Private Sub cmdbranch_Click()
Dim rn As Range
If combranch < "" Then
'ClearData
Set rn = Sheet1.Range("B2 ",
Sheet1.Range("B2").End(xlDown)).Find(combranch.Val ue, _
, , xlWhole, , xlNext)
If Not rn Is Nothing Then
DisableSave
Filenum.Value = rn.Offset(0, -1)

Actname.Value = combranch.Value
daterec.Value = rn.Offset(0, 1)
dateneed.Value = rn.Offset(0, 2)
datecomp.Value = rn.Offset(0, 3)
status1.Value = rn.Offset(0, 4)
vendor1.Value = rn.Offset(0, 5)
Actype1.Value = rn.Offset(0, 6)
Dept1.Value = rn.Offset(0, 7)
uw1.Value = rn.Offset(0, 8)

C.Value = rn.Offset(0, 9)
Q.Value = rn.Offset(0, 10)
EM.Value = rn.Offset(0, 11)
MR.Value = rn.Offset(0, 12)
MRC.Value = rn.Offset(0, 13)
EX.Value = rn.Offset(0, 14)
SP.Value = rn.Offset(0, 15)
RM.Value = rn.Offset(0, 16)
L.Value = rn.Offset(0, 17)
N.Value = rn.Offset(0, 18)
D.Value = rn.Offset(0, 19)
E.Value = rn.Offset(0, 20)
P.Value = rn.Offset(0, 21)
B.Value = rn.Offset(0, 22)
G.Value = rn.Offset(0, 23)
I.Value = rn.Offset(0, 24)
CR.Value = rn.Offset(0, 25)
S.Value = rn.Offset(0, 26)
CL.Value = rn.Offset(0, 27)
srvtype.Value = rn.Offset(0, 28)
Request1.Value = rn.Offset(0, 29)
otherdes.Value = rn.Offset(0, 30)
ActDes.Value = rn.Offset(0, 31)
subnum.Value = rn.Offset(0, 32)
polnum.Value = rn.Offset(0, 33)
UserForm1.rownumber.Value = Filenum.Value + 1

Else
MsgBox "Account Name not found. Please Try Again."
End If
Else
combranch.Text = "Please Enter Account Name."
End If
Set rn = Nothing
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if formula - multi criteria Belinda7237 Excel Worksheet Functions 6 September 3rd 08 03:35 AM
multi-criteria retrievals hoosier41 Excel Discussion (Misc queries) 5 June 18th 08 08:19 PM
Lookup multi criteria oscarcounts Excel Worksheet Functions 7 March 11th 08 06:22 PM
Multi Criteria lookup epotter Excel Discussion (Misc queries) 3 July 6th 06 12:32 AM
Multi Criteria then sum lost at work Excel Worksheet Functions 13 June 28th 05 01:00 AM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"