Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50207

errorhandler when file was not found

$
0
0
Hello All,
Please take a look at code in below and help me how to solve the problem with errormsg:

Code:

strName = InputBox(Prompt:="Please enter model here", _
Title:="Model", Default:="xxxxxx")

If strName = "xxxxxx" Or _
strName = vbNullString Then
Sheets("Sheet1").Visible = False
Exit Sub
Else

With Sheets("Sheet1").Select
On Error GoTo errormsg
    Cells.Find(What:=strName, After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
        ActiveCell.EntireColumn.Select
      Selection.Copy Destination:=Sheets("Result").Range("C1")
        End With
  End If
 
errormsg:
        MsgBox "Error"

Regards,
tt3

Viewing all articles
Browse latest Browse all 50207

Trending Articles