Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"