colinharwood
Active Member
- Joined
- Jul 27, 2002
- Messages
- 440
- Office Version
- 365
- Platform
- Windows
Hi
I use the following code to search for a members surname in a worksheet, and having found it, display a userform to show the details from the row. I have duplicate surnames in the worksheet and I would like to add a spin button to the userform to be able to view duplicate surnames in the userform, in turn.
Is this possible.
thanks
Private Sub SearchForMember2()
Dim FindString As String
Dim rng As Range
Dim Number As Range
Dim SelectedCell As String
FindString = Member.Value
If Trim(FindString) <> "" Then
With Sheets("tmes members").Range("B:B")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.GoTo rng
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Select
End If
End With
Else: Exit Sub
End If
FindAMember2.Hide
DisplayMemberDetails
End Sub
I use the following code to search for a members surname in a worksheet, and having found it, display a userform to show the details from the row. I have duplicate surnames in the worksheet and I would like to add a spin button to the userform to be able to view duplicate surnames in the userform, in turn.
Is this possible.
thanks
Private Sub SearchForMember2()
Dim FindString As String
Dim rng As Range
Dim Number As Range
Dim SelectedCell As String
FindString = Member.Value
If Trim(FindString) <> "" Then
With Sheets("tmes members").Range("B:B")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.GoTo rng
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Select
End If
End With
Else: Exit Sub
End If
FindAMember2.Hide
DisplayMemberDetails
End Sub