![]() |
Autofill
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 -- popp ----------------------------------------------------------------------- poppy's Profile: http://www.excelforum.com/member.php...fo&userid=1145 View this thread: http://www.excelforum.com/showthread.php?threadid=27559 |
Autofill
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 -- ehnt ----------------------------------------------------------------------- ehntd's Profile: http://www.excelforum.com/member.php...fo&userid=1586 View this thread: http://www.excelforum.com/showthread.php?threadid=27559 |
All times are GMT +1. The time now is 02:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com