B
BernzG
Hi,
Can someone please help me here - trying to get Find and FindNext to
work within to populate data within a form to enable it to be edited.
Private Sub CommandButton1_Click()
Dim Loc As String
Loc = Format(TextBox1.Value, "####")
Sheets("Sheet1").Select
Cells.Find(What:=Loc, After:=ActiveCell, LookIn:=xlValues, LookAt:=
_
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
With Worksheets("Sheet1")
Set C = .Range("A:A").Find(Loc, LookIn:=xlValues)
If Not C Is Nothing And .Cells(C.Row, 1) <> Loc Then firstAddress =
C.Address
Do
Set C = .Range("A:A").FindNext(C)
Loop While Not C Is Nothing And .Cells(C.Row, 1) <> Loc And
C.Address <> firstAddress
TextBox2 = .Cells(C.Row, 2)
TextBox3 = .Cells(C.Row, 3)
End With
End Sub
Cheers,
Bernz
Can someone please help me here - trying to get Find and FindNext to
work within to populate data within a form to enable it to be edited.
Private Sub CommandButton1_Click()
Dim Loc As String
Loc = Format(TextBox1.Value, "####")
Sheets("Sheet1").Select
Cells.Find(What:=Loc, After:=ActiveCell, LookIn:=xlValues, LookAt:=
_
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
With Worksheets("Sheet1")
Set C = .Range("A:A").Find(Loc, LookIn:=xlValues)
If Not C Is Nothing And .Cells(C.Row, 1) <> Loc Then firstAddress =
C.Address
Do
Set C = .Range("A:A").FindNext(C)
Loop While Not C Is Nothing And .Cells(C.Row, 1) <> Loc And
C.Address <> firstAddress
TextBox2 = .Cells(C.Row, 2)
TextBox3 = .Cells(C.Row, 3)
End With
End Sub
Cheers,
Bernz