bettygoodspeed
New Member
- Joined
- Aug 31, 2020
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
Hi everyone,
I created a basic data entry form. I didnt use the insert userform, instead I just used a small macro to allow the user to enter data into the 'form' and then have it populate the spreadsheet on another tab. (so they dont mess up the main data).
I want to allow the users to be able to search by name but we do have some duplicate records (intentionally). Ideally, they could click the search button and enter Smith, then if its not the right Smith, they can click next or something like that. I have been trying for days to get this darn thing to work. My code for the search is below... I'm so grateful for any assistance. I've googled and googled but no luck. Please help. Thank you so much.
'search box
searchvalue = sourcesheet.Range("C8").Value
'Is Name in there already?
If searchvalue <> vbNullString Then
'search code
Set Rng = dataidcol.find(what:=searchvalue, _
LookIn:=xlValues, lookat:=xlWhole, _
searchorder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not Rng Is Nothing Then
'if yes
nextrow = Rng.Row
Else
'input new record
nextrow = datasheet.Range("G" & datasheet.Rows.Count).End(xlUp).Offset(1).Row
End If
I created a basic data entry form. I didnt use the insert userform, instead I just used a small macro to allow the user to enter data into the 'form' and then have it populate the spreadsheet on another tab. (so they dont mess up the main data).
I want to allow the users to be able to search by name but we do have some duplicate records (intentionally). Ideally, they could click the search button and enter Smith, then if its not the right Smith, they can click next or something like that. I have been trying for days to get this darn thing to work. My code for the search is below... I'm so grateful for any assistance. I've googled and googled but no luck. Please help. Thank you so much.
'search box
searchvalue = sourcesheet.Range("C8").Value
'Is Name in there already?
If searchvalue <> vbNullString Then
'search code
Set Rng = dataidcol.find(what:=searchvalue, _
LookIn:=xlValues, lookat:=xlWhole, _
searchorder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not Rng Is Nothing Then
'if yes
nextrow = Rng.Row
Else
'input new record
nextrow = datasheet.Range("G" & datasheet.Rows.Count).End(xlUp).Offset(1).Row
End If