Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Fill Down to Last Value

I have 2 spreadsheets (Sheet 1 and Sheet 2). Sheet 1 has one header row and
sheet 2 has 2 header rows. I am using the following to count the number of
rows in Sheet 1 and copy a formula to every row in Sheet 2 based on the count
from Sheet 1.


With Worksheets("Sheet1")
lStop = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Worksheets("Sheet2").Range("3:" & lStop + 1).FillDown

The formula is perfect except when I only have one entry in Sheet 1. In
this case the formula copies the second header row in Sheet 2 instead of the
formula in the 3rd row. Any ideas/suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Fill Down to Last Value

Does changing your last line of posted code to this do what you want...

Worksheets("Sheet2").Range("3:" & lStop + 1 - (lStop = 1)).FillDown

--
Rick (MVP - Excel)


"LostInNY" wrote in message
...
I have 2 spreadsheets (Sheet 1 and Sheet 2). Sheet 1 has one header row
and
sheet 2 has 2 header rows. I am using the following to count the number
of
rows in Sheet 1 and copy a formula to every row in Sheet 2 based on the
count
from Sheet 1.


With Worksheets("Sheet1")
lStop = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Worksheets("Sheet2").Range("3:" & lStop + 1).FillDown

The formula is perfect except when I only have one entry in Sheet 1. In
this case the formula copies the second header row in Sheet 2 instead of
the
formula in the 3rd row. Any ideas/suggestions?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Fill Down to Last Value

Try..

If lstop 2 Then
Worksheets("Sheet2").Range("3:" & lstop + 1).FillDown
End If


"LostInNY" wrote:

I have 2 spreadsheets (Sheet 1 and Sheet 2). Sheet 1 has one header row and
sheet 2 has 2 header rows. I am using the following to count the number of
rows in Sheet 1 and copy a formula to every row in Sheet 2 based on the count
from Sheet 1.


With Worksheets("Sheet1")
lStop = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Worksheets("Sheet2").Range("3:" & lStop + 1).FillDown

The formula is perfect except when I only have one entry in Sheet 1. In
this case the formula copies the second header row in Sheet 2 instead of the
formula in the 3rd row. Any ideas/suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Fill Down to Last Value

Hi,
I'm still trying to work this one out, it looks like this code is meant to
copy whatever is on row 3 in sheet 2 down as many rows as you have entries
in sheet 1. Which means if you have 1 entry in sheet 1 you will have 2
entries in sheet 2. Try changing the +1 to +2.

Regards
Steve


"LostInNY" wrote in message
...
I have 2 spreadsheets (Sheet 1 and Sheet 2). Sheet 1 has one header row
and
sheet 2 has 2 header rows. I am using the following to count the number
of
rows in Sheet 1 and copy a formula to every row in Sheet 2 based on the
count
from Sheet 1.


With Worksheets("Sheet1")
lStop = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Worksheets("Sheet2").Range("3:" & lStop + 1).FillDown

The formula is perfect except when I only have one entry in Sheet 1. In
this case the formula copies the second header row in Sheet 2 instead of
the
formula in the 3rd row. Any ideas/suggestions?



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
what is the alternative for PlotArea.Fill. Fill property is hidden srinivas Tirumala[_2_] New Users to Excel 1 September 4th 09 09:36 PM
Some formulas don't track copies, pastes, fill right, fill down whiten Excel Discussion (Misc queries) 2 October 1st 06 04:41 PM
Fill in form to type Item descrictions and costs and fill in funct cradino Excel Worksheet Functions 0 July 16th 06 08:44 PM
I have a list of data, fill in the gaps. FILL function won't work Triv Excel Discussion (Misc queries) 1 September 17th 05 02:33 PM
The fill feature in Excel that gives option to fill or copy KAHelman New Users to Excel 1 July 29th 05 07:47 PM


All times are GMT +1. The time now is 06:02 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"