Macro to Autofill Down

TXRH

New Member
Joined
Feb 4, 2011
Messages
5
Hello,

I recorded a macro and it wrote the code using specifics:

Sub Macro7()
Range("A1").Select
Selection.End(xlDown).Select
Selection.AutoFill Destination:=Range("A92:A151")
Range("A92:A151").Select
Range("A1").Select
Selection.End(xlDown).Select
Selection.AutoFill Destination:=Range("A152:A156")
Range("A152:A156").Select
End Sub

Those ranges are going to vary. Basically I want a macro to:
Ctrl+Home
Ctrl+[down arrow]
Then fill down that cell until the next value

Any suggestions how to deal with the destination range?

Thank you!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Perhaps

Code:
Sub eeeee()
Dim LR As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Range("A1").AutoFill Destination:=Range("A1:A" & LR)
End Sub
 
Upvote 0
Here is what I went with

Range("A1").Select
Selection.End(xlDown).Select
Selection.AutoFill Destination:=Range(ActiveCell, ActiveCell.End(xlDown).Offset(-1, 0))

Thank you for your help!
 
Upvote 0
I just joined this form to express my thanks for your post. Your post brought an end to my 4 hour of frustration.

Perhaps

Code:
Sub eeeee()
Dim LR As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Range("A1").AutoFill Destination:=Range("A1:A" & LR)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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