need ErrHandling after no search result Notepad

Djinn88

New Member
Joined
Dec 11, 2013
Messages
2
Hi All,

I am a newbie on macro's and still learning :cool:. Hope you can help me out. I have a working sendkeys macro. Accept for one part that I can't figure out; ErrHandler1.

Problem: No search result error from notepad if text is not present in notepad file
Solution looking for: if no result, Close pop-up, and start macro from start again with the next value

Preciate all the help i can get

Kind regards





Code:
Sub RemoveRow()

Sheets("Test").Select
StartMacro:
 
 On Error GoTo ErrHandler1
 Do While (Selection.Offset(0, 0) <> "")
 If ActiveCell.Value = "" Then Exit Sub
 
 Selection.Copy
 AppActivate "db_"
 Application.Wait Now + TimeValue("00:00:01")
 SendKeys "^f"
 SendKeys "^v"
 SendKeys "~"
 SendKeys "{ESC}"
 Application.Wait Now + TimeValue("00:00:01")
 SendKeys "{HOME}"
 SendKeys "+{DOWN}"
 SendKeys "{DEL}"
 Application.Wait Now + TimeValue("00:00:01")
 SendKeys "^f"
 SendKeys "Contr.rek."
 SendKeys "{TAB}"
 SendKeys "{TAB}"
 SendKeys "{UP}"
 SendKeys "~"
 Application.Wait Now + TimeValue("00:00:01")
 SendKeys "{ESC}"
 SendKeys "{HOME}"
 
 Application.Wait Now + TimeValue("00:00:01")
 AppActivate "LSMW"
 Selection.Offset(0, 1).Select
 ActiveCell.FormulaR1C1 = "OK"
 Application.CutCopyMode = False
 

Selection.Offset(0, -1).Select
Selection.Offset(1, 0).Select
Loop
Exit Sub
ErrHandler1:
 
Resume StartMacro
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top