Autofill using variables

  • Thread starter Thread starter Deecrypt
  • Start date Start date
D

Deecrypt

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
 
Try:

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

Mike F
 
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 said:
Try:

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

Mike F

Deecrypt said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top