Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sum new Column Added
I have Excell XP 2002, I have a macro that inserts two columns one is a date
field and one is a number field. After inserting the number column I would like to have a macro to place a sum formula in row 27 of the column. Any ideals. I have tried a couple others that have been offered, and nothing seems to be working. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sum new Column Added
try using the macro recorder. turn it on, then
insert column write your sum formula in row 27 turn off macro recorder. the resulting macro code should give you a pretty good place to start - you could probably just copy & paste that code into your current macro. :) susan On Aug 7, 10:30 am, Jul in Ohio wrote: I have Excell XP 2002, I have a macro that inserts two columns one is a date field and one is a number field. After inserting the number column I would like to have a macro to place a sum formula in row 27 of the column. Any ideals. I have tried a couple others that have been offered, and nothing seems to be working. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sum new Column Added
try
Sub insertcolumnsandsum() ac = ActiveCell.Column ar = 1 With Cells(ar, ac) .Resize(, 2).EntireColumn.Insert .Offset(27, 0).Formula = _ "=sum(r1c" & ac + 2 & ":r27c" & ac + 2 & " )" End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Jul in Ohio" wrote in message ... I have Excell XP 2002, I have a macro that inserts two columns one is a date field and one is a number field. After inserting the number column I would like to have a macro to place a sum formula in row 27 of the column. Any ideals. I have tried a couple others that have been offered, and nothing seems to be working. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sum new Column Added
assume the first column is Date and the second is the values to be summed.
icol = 10 Columns(icol).Resize(,2).Insert cells(27,icol + 1).Formula = "=Sum(K1:K26)" Change the 10 to the column number of the new column which will be the date column. -- Regards, Tom Ogilvy "Jul in Ohio" wrote: I have Excell XP 2002, I have a macro that inserts two columns one is a date field and one is a number field. After inserting the number column I would like to have a macro to place a sum formula in row 27 of the column. Any ideals. I have tried a couple others that have been offered, and nothing seems to be working. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sum new Column Added
Forgot to change the address in the formula when I decided to generalize the
macro. cells(27,icol + 1).Formula = "=Sum(K1:K26)" should be cells(27,icol + 1).FormulaR1C1 = "=Sum(R1C:R26C)" -- Regards, Tom Ogilvy "Tom Ogilvy" wrote: assume the first column is Date and the second is the values to be summed. icol = 10 Columns(icol).Resize(,2).Insert cells(27,icol + 1).Formula = "=Sum(K1:K26)" Change the 10 to the column number of the new column which will be the date column. -- Regards, Tom Ogilvy "Jul in Ohio" wrote: I have Excell XP 2002, I have a macro that inserts two columns one is a date field and one is a number field. After inserting the number column I would like to have a macro to place a sum formula in row 27 of the column. Any ideals. I have tried a couple others that have been offered, and nothing seems to be working. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum a column correctly after more info is added by sorting | Excel Worksheet Functions | |||
added unwanted data in column | New Users to Excel | |||
Can column character be added? | Excel Programming | |||
Determine if Row/Column was Added/Deleted | Excel Programming | |||
How can I get auto sum of column when new figures are added | New Users to Excel |