Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlFillDefault
I have the following code:
..Range("A1:E1").Select Selection.AutoFill Destination:=Range("A1:E" & MCLastRow), Type:=xlFillDefault The problem is B1 and E1 have a month and a number respectively. I want the same month and same number to filldown but it's incrementing like this: January 1 February 2 March 3 etc. I want it to fill down like this: January 1 January 1 January 1 How do I make this happen? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlFillDefault
There are other options for the type parm.
Maybe you can use: xlFillCopy If you can't one type for all the columns, maybe you can do it column by column specifying the type of fill you want. Bishop wrote: I have the following code: .Range("A1:E1").Select Selection.AutoFill Destination:=Range("A1:E" & MCLastRow), Type:=xlFillDefault The problem is B1 and E1 have a month and a number respectively. I want the same month and same number to filldown but it's incrementing like this: January 1 February 2 March 3 etc. I want it to fill down like this: January 1 January 1 January 1 How do I make this happen? -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlFillDefault
To fill E based on range in D:
Sub fill() Dim lastrow As Long lastrow = Worksheets("Sheet1").Cells(Rows.Count, "D").End(xlUp).Row Range("E1").AutoFill Range("E1:E" & lastrow), xlFillCopy End Sub HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Dave Peterson" wrote: There are other options for the type parm. Maybe you can use: xlFillCopy If you can't one type for all the columns, maybe you can do it column by column specifying the type of fill you want. Bishop wrote: I have the following code: .Range("A1:E1").Select Selection.AutoFill Destination:=Range("A1:E" & MCLastRow), Type:=xlFillDefault The problem is B1 and E1 have a month and a number respectively. I want the same month and same number to filldown but it's incrementing like this: January 1 February 2 March 3 etc. I want it to fill down like this: January 1 January 1 January 1 How do I make this happen? -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlFillDefault
The OP wanted to fill A:E, though.
ryguy7272 wrote: To fill E based on range in D: Sub fill() Dim lastrow As Long lastrow = Worksheets("Sheet1").Cells(Rows.Count, "D").End(xlUp).Row Range("E1").AutoFill Range("E1:E" & lastrow), xlFillCopy End Sub HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Dave Peterson" wrote: There are other options for the type parm. Maybe you can use: xlFillCopy If you can't one type for all the columns, maybe you can do it column by column specifying the type of fill you want. Bishop wrote: I have the following code: .Range("A1:E1").Select Selection.AutoFill Destination:=Range("A1:E" & MCLastRow), Type:=xlFillDefault The problem is B1 and E1 have a month and a number respectively. I want the same month and same number to filldown but it's incrementing like this: January 1 February 2 March 3 etc. I want it to fill down like this: January 1 January 1 January 1 How do I make this happen? -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|