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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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