Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
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
Sum a column correctly after more info is added by sorting Soulscream Excel Worksheet Functions 9 January 22nd 09 08:53 PM
added unwanted data in column daisydawg New Users to Excel 1 December 27th 08 09:55 PM
Can column character be added? jimmy[_5_] Excel Programming 2 March 9th 07 02:47 PM
Determine if Row/Column was Added/Deleted JLGWhiz Excel Programming 1 December 10th 06 10:29 PM
How can I get auto sum of column when new figures are added Dave New Users to Excel 2 July 18th 06 05:21 PM


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