Compile Error: Named Argument Not Found???

Anthony G.

Active Member
Joined
Mar 24, 2002
Messages
465
Jimiskey was kind enough to provide me with this code, but I get a compile error stating that the named argument is not found with the SearchFormat text under highlights.

Any suggestion?

Thanks,

Anthony

Ok, try this code:

Sub InsertRows()
'
'Start at cell A1
Range("A1").Select
'Loop through finding the word Total and insert blank line afterwards
Do
Cells.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Select
'If you find Grand Total, stop you are done
If Left(ActiveCell.Value, 11) = "Grand Total" Then
Exit Sub
End If
Loop

End Sub
 
Andrew, many thanks. You saved my life haha

In the script I was working on, it didn't like "SearchFormat:=False" and "ReplaceFormat:=False". It gave me an error on both lines, but I had more confidence deleting them after I read your reply on this thread.

Many thanks.
 
Upvote 0

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.

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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