PDA

View Full Version : Solved: Need error handler



ndendrinos
09-23-2006, 07:14 AM
need an error handler at the end of mdmackillop's code
Thank you



Option Explicit
Option Compare Text



Private Sub CommandButton1_Click()
Dim Cel As Range
Set Cel = Sheets("Sheet2").Columns(1).Find(TextBox1)
Cel.Resize(, 12).Copy Sheets("Sheet1").Range("A2")
End Sub

mdmackillop
09-23-2006, 07:39 AM
Private Sub CommandButton1_Click()
Dim Cel As Range
Set Cel = Sheets("Sheet2").Columns(1).Find(textbox1)
If Not Cel Is Nothing Then
Cel.Resize(, 12).Copy Sheets("Sheet1").Range("A2")
Else
MsgBox textbox1 & " not found"
End If
End Sub

ndendrinos
09-23-2006, 01:16 PM
Yes now it is perfect. Thank you again mdmackillop.
Best regards
Nick