Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting and Summing with VBA


Hi everyone, this is my first post, so I wanted to start out saying "He
there!" I'm 22, have done minor programming with HTML, PHP, etc, Acces
and Excel now being my interests, so I thought I'd get a question out o
the way that has been bugging me for the better part of the day.

What I have is a list of data in excel, going from A4:CX (x bein
variable, as it changes daily how long this list is). I want to writ
a macro that will count how many items are in that range, and then su
the items in C4:CX. I don't know how to let VBA know how many row
contain data, so that's where my trouble right now is coming from. I
someone could step me in the right direction, I should be able t
figure out the summing and counting from there.

Thanks, and I'm glad to be here :o

--
Martin_Austi
-----------------------------------------------------------------------
Martin_Austin's Profile: http://www.excelforum.com/member.php...fo&userid=1638
View this thread: http://www.excelforum.com/showthread.php?threadid=27755

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Counting and Summing with VBA

How do you know what X is?

Assuming you know that value, then all you need is

mySum = WorksheetFunction.SUM(Range("C4:C" & X)

If you don't know, you could try

cRows = Cells(Rows.Count,"C").End(xlUp).Row
mySum = WorksheetFunction.SUM(Range("C4:C" & cRows)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Martin_Austin" wrote in
message ...

Hi everyone, this is my first post, so I wanted to start out saying "Hey
there!" I'm 22, have done minor programming with HTML, PHP, etc, Access
and Excel now being my interests, so I thought I'd get a question out of
the way that has been bugging me for the better part of the day.

What I have is a list of data in excel, going from A4:CX (x being
variable, as it changes daily how long this list is). I want to write
a macro that will count how many items are in that range, and then sum
the items in C4:CX. I don't know how to let VBA know how many rows
contain data, so that's where my trouble right now is coming from. If
someone could step me in the right direction, I should be able to
figure out the summing and counting from there.

Thanks, and I'm glad to be here :o)


--
Martin_Austin
------------------------------------------------------------------------
Martin_Austin's Profile:

http://www.excelforum.com/member.php...o&userid=16382
View this thread: http://www.excelforum.com/showthread...hreadid=277559



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
Summing (or counting) cells until there is a blank cell Box815 Excel Discussion (Misc queries) 3 November 17th 06 03:35 PM
Counting & Summing based on criteria on another column Chicago D Excel Discussion (Misc queries) 2 August 25th 05 06:58 PM
Counting and Summing Drew Excel Discussion (Misc queries) 3 May 5th 05 04:44 PM


All times are GMT +1. The time now is 12:33 AM.

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"