J
Jim15
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
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