'Autofill with VBA when columns are dynamic too?
I transposed dynamic number of rows to columns in an adjacent table (same sheet) to use as headers and then loop a formula into then next row for each header. I need VBA to select the whole range I just wrote formulas to and then to autofill selected columns down a defined amount of times (defined with a variable/integer in a cell).
My # of columns AND rows will change because the number of rows in my origin table will change (columns in new table) and the number of iterations defined will change (rows in new table). This is a portion of my code:
Range(Selection, Selection.End(xlToRight)).Select
Selection.AutoFill Destination:=Range("Q3:" & "AW" & "lastrow"), Type:=xlFillDefault
Here, lastrow takes care of the dynamic rows, but how can I replace the AW with code that represents the last column if it becomes AA, BZ, or anything else?
I can't seem to figure it out, hoping somebody smart can aid me here...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
