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: 1
Default Counting rows in Excel spreadsheet.


I recorded the following macro to calculate data in rows. However, the
spreadsheet I was working with had 421 rows. Is there something that
will replace the following lines to only process the number of rows in
a spreadsheet that are present?

Selection.AutoFill Destination:=Range("I2:I421")
Range("I2:I421").Select
Cells.Select


Thanks,

Jim

Sub Prod_Abstract()
'
' Prod_Abstract Macro
' Macro recorded 3/9/2006 by JBW
'
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
ActiveCell.FormulaR1C1 = "MMCFE"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=SUM((RC[-2]*6+RC[-1])/1000)"
Selection.Copy
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("I2:I421")
Range("I2:I421").Select
Cells.Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal
Columns("G:I").Select
Selection.NumberFormat = "#,##0"
End Sub


--
Jim15
------------------------------------------------------------------------
Jim15's Profile: http://www.excelforum.com/member.php...o&userid=26300
View this thread: http://www.excelforum.com/showthread...hreadid=547911

 
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
Counting rows in a spreadsheet, but I don't want to count hidden r petprincess Excel Discussion (Misc queries) 1 April 21st 08 09:08 PM
Excel 2003 function for counting rows with two conditions. NikkiTheNovice Excel Worksheet Functions 3 June 25th 07 12:47 AM
Counting rows, then counting values. Michael via OfficeKB.com Excel Discussion (Misc queries) 7 August 4th 05 10:57 PM
Counting Rows Then Counting Values in Columns Michael via OfficeKB.com Excel Programming 1 June 1st 05 04:10 PM
cells() and counting number or rows on spreadsheet HeatherO Excel Worksheet Functions 7 March 2nd 05 10:36 AM


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

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"