LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Macro with sum function

I am trying to write a macro that will sum a set numbers that are a part of a
column. I have inserted empty rows to use as breaks for the Ctl+down or
END.Down commands to define the range. I then use the Sum button to total
the selection and then I cut and paste the value over to new column. When I
run the macro it does not place the sum in the cell and cuts and pastes the
last cell in the range.
Any ideas?
below is the code for the macro.

ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.End(xlToLeft).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
Selection.End(xlUp).Select
ActiveCell.Offset(0, 9).Range("A1").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Range("A1:A7").Select
ActiveCell.Offset(6, 0).Range("A1").Activate
ActiveCell.FormulaR1C1 = "=SUM(R[-6]C:R[-1]C)"
ActiveCell.Offset(-6, 0).Range("A1:A7").Select
Selection.End(xlDown).Select
Selection.Cut
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -3).Range("A1").Select
Selection.End(xlDown).Select
End Sub
 
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
Using A Function in a Macro Jai_Friday Excel Worksheet Functions 2 March 13th 08 01:18 PM
MACRO & FUNCTION FARAZ QURESHI Excel Discussion (Misc queries) 2 February 11th 08 06:26 PM
Not sure what function, macro, etc to use Tony Excel Worksheet Functions 2 January 6th 08 06:10 PM
Sub Macro vrs Function Macro Auto Start Pat Excel Discussion (Misc queries) 7 June 6th 07 09:53 PM
Macro With IF Function marello Excel Worksheet Functions 0 November 10th 05 03:55 PM


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