Autofill

  • Thread starter Thread starter poppy
  • Start date Start date
P

poppy

Hi All

I have this piece of code. With this code I pick up the lastcolumn wit
data in my sheet. What I now have to do is to give them month headings
My code does this, but I need it to do more. I need it to skip a colum
after every month. Below the code is an example of what I mean.


Code
-------------------
'Fill in the month names
lastcol = Cells(2, Columns.Count).End(xlToLeft).Column

For i = 6 To lastcol
For j = 1 To 1 Step 3
With Cells((j), (i))
.FormulaR1C1 = "January"
.AutoFill Destination:=.Resize(, 2), Type:=xlFillDefault
End With
Next
Nex
-------------------


Example of what it should do: After January skip one column, afte
february skip one column and so forth.

Code
-------------------
January February March
Group Qty Value Qty Value Qty Value
Bracelet 3 5.00 4 8.00 0 0.00
Ring 3 9.00 0 0.00 2 6.00
Ear rings 4 6.00 5 7.00 0 0.00

-------------------


Your help would be very appreciated.

Kind Regard
 
Range("A1").Value = "January"
Range("A3").Value = "February"
Range("A5:D5").Select
Selection.AutoFill Destination:=Range("A5:I5")
Type:=xlFillDefault
Range("A5:I5").Select

This will give you the spaces that you need in between, then you ca
just generalize it if you need more than one year
 

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