Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default NEWBIE: How to sum cells using VBA

Brand new and trying my best at VBA ... in advance, thank you for your
help!

My worksheets will have a different number of rows each time they are
generated. Trying to show the sum for Column C, Column D and Column E
(individually). I can write the code to show the sum, but it requires
that I have the cursor in the specific cell.

Want to be able to run the macro, have it find the last row with
numbers, then jump down one row and show the sum for each column.

--Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default NEWBIE: How to sum cells using VBA

As an example

iLastRow = Cells(Rows.Count,"D").End(xlUp).Row

Cells(iLastRow+1,"D").Formula = "=SUM(D1:D" & iLastRow & ")"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"chuber" wrote in message
oups.com...
Brand new and trying my best at VBA ... in advance, thank you for your
help!

My worksheets will have a different number of rows each time they are
generated. Trying to show the sum for Column C, Column D and Column E
(individually). I can write the code to show the sum, but it requires
that I have the cursor in the specific cell.

Want to be able to run the macro, have it find the last row with
numbers, then jump down one row and show the sum for each column.

--Chris



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
Newbie Date cells so most recent is on top [email protected] Excel Worksheet Functions 1 May 14th 06 02:48 AM
Newbie Q: Range from two cells Garry[_8_] Excel Programming 5 December 14th 05 08:01 AM
Newbie needs help with incrementing a series of cells mikeod Excel Worksheet Functions 5 November 16th 05 08:19 PM
Newbie : Sum Cells Part 2 RM[_2_] Excel Programming 3 February 24th 04 06:54 AM
Newbie : How to sum cells via VBA code. Rich[_16_] Excel Programming 5 February 24th 04 02:30 AM


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