troubleshooting Question

Autofill Dynamic Range

Avatar of maderitetech
maderitetech asked on
Microsoft Excel
6 Comments1 Solution1408 ViewsLast Modified:
I'm creating a macro that fills a range that changes every time it is run. The only thing consistent about the range is that it begins on row 7 of the active cell. The column filled changes every time. The number of rows may change. Therefore code like the following will not work.

Range("A2").AutoFill Destination:=Range("A2:A" & LastRow)
I need something more dynamic like this.
ActiveCell.AutoFill Destination:=Range(ActiveCell.Address & ":" & ActivceCell.Column & LastRow)
That will not work because the column property of the active cell returns a number, not a column letter. I maybe could try to convert the number to a letter, but it gets complicated after the letter Z.
Is there any way to auto-fill a completely dynamic range? (Well, as close to dynamic that I can think of.)
I also have tried substituting the Cells function inside of the Range function. No go.
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros