xlFillDefault

B

Bishop

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?
 
D

Dave Peterson

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.
 
R

ryguy7272

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---
 
D

Dave Peterson

The OP wanted to fill A:E, though.
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---
 

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

Top