Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default autofill range

I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily. some
days 30 rows..some days 80 rows. so no matter what the row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default autofill range

How do you know that last row?

I used column A to determine it:

With activesheet
.range("f4:f" & .cells(.rows.count,"A").end(xlup).row).formular1c1 _
= "=NETWORKDAYS(R1C5,RC[-1])"
End with

Stephen wrote:

I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily. some
days 30 rows..some days 80 rows. so no matter what the row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default autofill range

I keep getting an error at the .cell(.row.count
part of your code.

I have the first dates in column e, starting at e3, i have
the empty cells in column f to fill with the networkdays
formula, i have the absolute value data in $k$2.

tks.


-----Original Message-----
How do you know that last row?

I used column A to determine it:

With activesheet
.range("f4:f" & .cells(.rows.count,"A").end

(xlup).row).formular1c1 _
= "=NETWORKDAYS(R1C5,RC[-1])"
End with

Stephen wrote:

I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily.

some
days 30 rows..some days 80 rows. so no matter what the

row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill


--

Dave Peterson

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default autofill range

You dropped a few s's from the original code:

..cells not .cell
..rows.count not .row.count


With activesheet
.range("f4:f" & .cells(.rows.count,"A").end(xlup).row).formular1c1 _
= "=NETWORKDAYS(R1C5,RC[-1])"
End with

And change that "A" to the column that defines the lastrow (E?).



Stephen wrote:

I keep getting an error at the .cell(.row.count
part of your code.

I have the first dates in column e, starting at e3, i have
the empty cells in column f to fill with the networkdays
formula, i have the absolute value data in $k$2.

tks.

-----Original Message-----
How do you know that last row?

I used column A to determine it:

With activesheet
.range("f4:f" & .cells(.rows.count,"A").end

(xlup).row).formular1c1 _
= "=NETWORKDAYS(R1C5,RC[-1])"
End with

Stephen wrote:

I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily.

some
days 30 rows..some days 80 rows. so no matter what the

row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill


--

Dave Peterson

.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default autofill range

Stephen

try this:

Range("F4").FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").AutoFill _
Range(Range("F4"), Range("F4").Offset(0, -1).End(xlDown).Offset(0,
1))

Regards

Trevor


"Stephen" wrote in message
...
I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily. some
days 30 rows..some days 80 rows. so no matter what the row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default autofill range

I assume here that your "data range" is 1 column to the left.

Sub Demo()
With [F4].Offset(0, -1)
With Range(.Address, .End(xlDown)).Offset(0, 1)
.Cells(1).FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
.FillDown
End With
End With
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Stephen" wrote in message
...
I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily. some
days 30 rows..some days 80 rows. so no matter what the row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill



  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default autofill range

I changed the layout of my page a little and your code
didn't work. but it worked the first time.

i have the first dates in column E starting at E3, I would
like the have the networkdays formula in Column F starting
in F3, and I have the Absolute Value date in $K$2.

Tks.


-----Original Message-----
I assume here that your "data range" is 1 column to the

left.

Sub Demo()
With [F4].Offset(0, -1)
With Range(.Address, .End(xlDown)).Offset(0, 1)
.Cells(1).FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-

1])"
.FillDown
End With
End With
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Stephen" wrote in

message
...
I have a formula in cell F4 that i want to copy down to
the end of the data range. the range fluxuates daily.

some
days 30 rows..some days 80 rows. so no matter what the

row
range the macro automatically fills the formula down to
the bottom of the range column. Here is what I have so
far. But not working.

Range("F4").Select
ActiveCell.FormulaR1C1 = "=NETWORKDAYS(R1C5,RC[-1])"
Range("F4").Select
Range(ActiveCell, ActiveCell.End(xlDown)).AutoFill



.

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic range for autofill macro Jim G Excel Discussion (Misc queries) 2 April 23rd 07 05:46 AM
autofill a column alongside a range - how ? tonto57 Excel Discussion (Misc queries) 4 March 21st 06 12:11 PM
autofill with dynamic range Bernie Deitrick[_2_] Excel Programming 0 September 16th 03 02:55 PM
autofill with dynamic range again a Excel Programming 0 September 16th 03 12:26 PM
Autofill Indefinite Range in VBA/Macros steve Excel Programming 0 August 25th 03 11:40 PM


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

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

About Us

"It's about Microsoft Excel"