ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlFillDefault (https://www.excelbanter.com/excel-programming/432100-xlfilldefault.html)

Bishop

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?

Dave Peterson

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

ryguy7272

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


Dave Peterson

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


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com