ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill using variables (https://www.excelbanter.com/excel-programming/380523-autofill-using-variables.html)

Deecrypt

Autofill using variables
 
Hi,
Please tell me what is wrong with the below statements. I'm positive
that it is a trivial error but I cant seem to figure this out. This
code works fine if I use absolute cells references i.e "D1:D7" rather
than pasteMonthStart, & pasteMonthEnd.

ActiveCell.Offset(0, 3).Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-3],""mmmmmmmmm_yyyy"")"
Range(pasteStart).Select
Selection.AutoFill Destination:=Range("pasteMonthStart, &
pasteMonthEnd")


Thank you kindly
Deecrypt


Mike Fogleman

Autofill using variables
 
Try:

Selection.AutoFill Destination:=Range(pasteMonthStart, pasteMonthEnd)

Mike F

"Deecrypt" wrote in message
ups.com...
Hi,
Please tell me what is wrong with the below statements. I'm positive
that it is a trivial error but I cant seem to figure this out. This
code works fine if I use absolute cells references i.e "D1:D7" rather
than pasteMonthStart, & pasteMonthEnd.

ActiveCell.Offset(0, 3).Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-3],""mmmmmmmmm_yyyy"")"
Range(pasteStart).Select
Selection.AutoFill Destination:=Range("pasteMonthStart, &
pasteMonthEnd")


Thank you kindly
Deecrypt




Deecrypt

Autofill using variables
 
Thanx for your prompt reply Mike,
I tried your solution but was unsuccessful. Eventually found the below
solution so am displaying that for the benefit of all.

Range(pasteMonthStart).Select
Selection.AutoFill Destination:=Range(pasteMonthStart & ":" &
pasteMonthEnd)

Thank you
Deecrypt

Mike Fogleman wrote:

Try:

Selection.AutoFill Destination:=Range(pasteMonthStart, pasteMonthEnd)

Mike F

"Deecrypt" wrote in message
ups.com...
Hi,
Please tell me what is wrong with the below statements. I'm positive
that it is a trivial error but I cant seem to figure this out. This
code works fine if I use absolute cells references i.e "D1:D7" rather
than pasteMonthStart, & pasteMonthEnd.

ActiveCell.Offset(0, 3).Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-3],""mmmmmmmmm_yyyy"")"
Range(pasteStart).Select
Selection.AutoFill Destination:=Range("pasteMonthStart, &
pasteMonthEnd")


Thank you kindly
Deecrypt




All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com