Code to auto fill down two rows from active selection.

richanor

Active Member
Joined
Apr 8, 2006
Messages
291
Hi,

I am using the following code to insert a couple of rows into a worksheet and then select a range above them. I want to be able to auto fill down into these two rows and then change the active cell to the next cell in column A ending with a 5 or a 0.

If the second part is not possible, could anybody help me with the code to auto fill down a couple of rows from the selected range?

Thanks

Rich

Code:
Sub InsertRows()
'
' InsertRows Macro
'
' Keyboard Shortcut: Ctrl+Shift+I
'
    Selection.EntireRow.Insert
    Selection.EntireRow.Insert
    ActiveCell.Offset(-3, -Selection.Column + 1).Range("A1:F3").Select

End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,225,228
Messages
6,183,725
Members
453,185
Latest member
radiantclassy

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