AutoFill 1004 runtime Error - Create a If error skip?

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
Hi All,<o:p></o:p>
<o:p></o:p>
I am using this autofill code for my macro.<o:p></o:p>
<o:p> </o:p>
Sheets("Data").Select<o:p></o:p>
'This counts the # of Rows in the Coulmn A<o:p></o:p>
IngoMaxRo = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row<o:p></o:p>
<o:p> </o:p><o:p> </o:p>
Range("R6:T6").Select<o:p></o:p>
Selection.AutoFill Destination:=Range("R6:T" & IngoMaxRo - 4)

The problem is that there are times when the IngoMaxRo will be equal to the source row. Hence creating a 1004 run time error.

I would like to know how to create an if error skip autofill if source row = autofill row. If sourcerow <> autofill row then autofill

Thanks in Advance!


 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Maybe something like:
Code:
[COLOR=#000000][FONT=Times New Roman]If[/FONT][/COLOR] ([COLOR=#000000][FONT=Times New Roman]IngoMaxRo - 4)>6 Then
[/FONT][/COLOR][COLOR=#000000][FONT=Times New Roman]    Selection.AutoFill Destination:=Range("R6:T" & IngoMaxRo - 4)
End If[/FONT][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,690
Members
449,329
Latest member
tommyarra

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