Autofill Destination with Dynamic Range from an ActiveCell

nwd9s

New Member
Joined
Feb 15, 2011
Messages
21
Hello-

I am looking for help on a macro I have written below. It has to do with the autofill destination not working properly with a dynamic range.

Any help to make the autofill code work is greatly appreciated!!


Code:
Sheets("Macro Workspace").Activate
    Dim InvestBoard As Long
        InvestBoard = Range("B" & Rows.Count).End(xlUp).Row
    Dim Invest As Long
        Invest = Range("A4").End(xlDown).Offset(1, 0)
    Range("A4").End(xlDown).Offset(1, 0).Formula = "=B" & Invest & ""
    ActiveCell.AutoFill Destination:=Range(ActiveCell, Cells(InvestBoard, ActiveCell.Column))

Many thanks,
Nathan
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Thanks for that, I made that correction, but the Autofill is still not working properly.
 
Upvote 0
Try activating that Cell first:

Code:
    Sheets("Macro Workspace").Activate
    Dim InvestBoard As Long
        InvestBoard = Range("B" & Rows.Count).End(xlUp).Row
    Dim Invest As Long
        Invest = Range("A4").End(xlDown).Offset(1, 0).Row
    Range("A4").End(xlDown).Offset(1, 0).Formula = "=B" & Invest & ""
    Range("A4").End(xlDown).Offset(1, 0).Activate
    ActiveCell.AutoFill Destination:=Range(ActiveCell, Cells(InvestBoard, ActiveCell.Column))
 
Upvote 0
Thanks Comfy, this worked well, just did not have it activated properly.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

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