E
enyaw
This is the code im using. The part from Founcell.Copy does not seem to be
working.
Can anyone help?
Private Sub CommandButton1_Click()
Dim wks As Worksheet
Dim FoundCell As Range
Set wks = Worksheets("Sheet1")
If Me.TextBox1.Value = "" Then
Beep
MsgBox "Please enter HRI"
Exit Sub
End If
With wks
With .Range("A:A")
Set FoundCell = .Cells.Find(what:=Me.TextBox1.Value, _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
Lookat:=xlWhole, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)
FoundCell.Copy
Sheets("Sheet2").Select
Range("A2").Select
ActiveSheet.Paste
UserForm1.Hide
Sheets("Sheet2").Select
End With
End With
If FoundCell Is Nothing Then
UserForm1.Hide
UserForm2.Show
Else
MsgBox "Found HRI: " & FoundCell.Value
End If
End Sub
working.
Can anyone help?
Private Sub CommandButton1_Click()
Dim wks As Worksheet
Dim FoundCell As Range
Set wks = Worksheets("Sheet1")
If Me.TextBox1.Value = "" Then
Beep
MsgBox "Please enter HRI"
Exit Sub
End If
With wks
With .Range("A:A")
Set FoundCell = .Cells.Find(what:=Me.TextBox1.Value, _
after:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
Lookat:=xlWhole, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)
FoundCell.Copy
Sheets("Sheet2").Select
Range("A2").Select
ActiveSheet.Paste
UserForm1.Hide
Sheets("Sheet2").Select
End With
End With
If FoundCell Is Nothing Then
UserForm1.Hide
UserForm2.Show
Else
MsgBox "Found HRI: " & FoundCell.Value
End If
End Sub