xlFillDefault, based on values in ColA to ColZ
You're specifying the worksheet when you find the dynarow, but you're relying on
the current selection in the next line.
I'd use:
Dim dynarow As Long
with worksheets("Worksheet")
dynarow = .Cells(.Rows.Count, "Z").End(xlUp).Row
.cells(dynarow,"A").resize(1,26).AutoFill _
Destination:=.cells(dynarow,"A").resize(2,26), Type:=xlFillDefault
end with
If that doesn't help, I'd make sure that dynarow was what I thought it was
supposed to be by adding a
Msgbox dynarow
before the autofill line.
ryguy7272 wrote:
I guess Im not going about this the right way. Im trying to find the last
used row, based on Column Z, then fill-down, the contents in A and 1 row
above to Z and 1 row above. For instance, if Z17 has data in it, I want to
copy down A16:Z16 into A17:Z17.
Heres the code Im trying:
Dim dynarow As Long
dynarow = Worksheets("Worksheet").Cells(Rows.Count, "Z").End(xlUp).Row
Selection.AutoFill Destination:=Range("A" & dynarow & ":Z" & dynarow + 1),
Type:=xlFillDefault
I keep getting the following error: €˜AutoFill method of range class failed
I guess the range is not defined properly.
Im completely open to suggestions as to how to do this.
Thanks!
--
Dave Peterson
|