Error Handling with set Fnd

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
140
Office Version
  1. 365
  2. 2019
Good morning,
when I run the code listed below it works perfect until I get to an empty cell then the Set Fnd area highlights yellow and I have to Debug. I've tried the If Fnd is Nothing then Exit sub (actually tried a variety of that) it just ignores it. I've also tried to use a message box as error handling in place of the If Fnd is Nothing but it tells me I have a For without Next. I've seen a variety of posts that are close to this problem and have tried to adapt them to mine but I either get the yellow highlights or missing Next. I have a feeling that I have just looked at this too long and the solution is right there in front of me. Another set of eyes would be greatly appreciated. Thanks :)


Sub Post()
Sheets("Worksheet_Issues").Select
Range("C2.C2500").Select
Set Fnd = Columns(1).Find(What:="Resolved", After:=ActiveCell, LookIn:=xlFormulas, _
Lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Fnd Is Nothing Then Exit Sub
ActiveCell.Offset(0, -2).Select
ActiveCell.Select
ActiveCell.Resize(, 13).Select
Selection.Copy
Application.CutCopyMode = True
Selection.Cut
Sheets("Deermine_Resolved").Select
ActiveSheet.Select
Range("A2:z2500").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveSheet.Paste
Sheets("Worksheet_Issues").Select
Next MyCell
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
That just highlighted the range on the worksheet then gave me a debug and highlighted in yellow from Set Fnd to SearchFormat:-False
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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