View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Autofill Destination

Hi Poppy,

Try changing:

Selection.AutoFill Destination:=Range("B14:H14"),
Type:=xlFillDefault
To

.AutoFill Destination:=Selection.Resize(12), Type:=xlFillDefault

Note the initial period.


---
Regards,
Norman



"poppy " wrote in message
...
Hi

I am trying to fill a number of cells with months up to the current
month without having to hardcode the months. My problem is in the red
line. I would appreciate all your help.


Code:
--------------------
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
lastrow = lastrow + 3

For i = 2 To 2
For j = lastrow To lastrow
With Cells((j), (i))
.FormulaR1C1 = "Jan"
Cells(j, i).Select
Selection.AutoFill Destination:=Range("B14:H14"), Type:=xlFillDefault
End With
Next
Next
--------------------


Kind regards


---
Message posted from http://www.ExcelForum.com/