LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Auto fill based on cRows calculation

The statement you have searches from the bottom, up, for the last used cell in the column. If
you have two blocks of data, and you want to work only with the first one, you can try

Cells(1, 7).End(xlDown).Row

which will return the row just above the first blank cell in column G. Note that to find the
last row in the block this way, you have to use a column that has no embedded blank cells.

Another possibility is

cRows = Range("A1").CurrentRegion.Rows.Count


On Fri, 8 Aug 2003 18:37:36 -0500, "Bruce Roberson" wrote:

If I have have 166 consecutive rows in column G that have information, and
then after that, there is a gap of lets say 192 rows before some unrelated
information is in column G there, then the formula for cRows yields 358,
when it should only yield the value of 166.

Dim Crows as Long
cRows = Cells(Rows.Count, "G").End(xlup).Row

I am using this kind of thing to work through the next few rows in which
I'm doing some copying of other row values based on the contiguous values in
column G as described above.

Range("a10:F10").AutoFill Destination:=Range("A10:F10", Cells(cRows, "A"))
Range("A10:F10", Cells(cRows, "A")).Copy
Range("A10:F10", Cells(cRows, "A")).PasteSpecial Paste:=xlValues


 
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
Auto fill text columns based on rows Cecilia Excel Worksheet Functions 3 March 29th 10 10:51 PM
Auto-Fill Column based on data in each row Dave Excel Worksheet Functions 7 May 23rd 09 10:24 AM
auto fill rows with months based on cell value Drew[_2_] Excel Discussion (Misc queries) 5 March 31st 08 08:40 AM
auto fill columns based on a selection ckane Excel Discussion (Misc queries) 1 May 4th 07 05:34 AM
Auto fill Column based on data in other columns SITCFanTN New Users to Excel 1 June 6th 06 09:04 PM


All times are GMT +1. The time now is 07:46 AM.

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"