Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default summing in vba

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default summing in vba

If you know the column that you are putting the data in, for instance, column
F, then you could use:

Sub addItup()
Dim mySum As Double
mySum = WorksheetFunction.Sum(Range("F2":F" _
& Range("F65536").End(xlUp).Row)
MsgBox mySum
End Sub

That would give you the sum of the values in column F as a dynamic range,
assuming a header row.


"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default summing in vba

I might have left a bracket off. If so you will get a run time error. Just
add a parenthesis on the end.

"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default summing in vba

I did miss one. Here is what it should be:

mySum = WorksheetFunction.Sum(Range("F2":F" _
& Range("F65536").End(xlUp).Row))


"JLGWhiz" wrote:

If you know the column that you are putting the data in, for instance, column
F, then you could use:

Sub addItup()
Dim mySum As Double
mySum = WorksheetFunction.Sum(Range("F2":F" _
& Range("F65536").End(xlUp).Row)
MsgBox mySum
End Sub

That would give you the sum of the values in column F as a dynamic range,
assuming a header row.


"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default summing in vba

I dont actually know the column, its going to be done inside the loop. the no
of columns is limited by the no of shifts to be worked in the program.

It needs to actually work off the 2 counters, counter 1 = column, counter 2
= row



"JLGWhiz" wrote:

I might have left a bracket off. If so you will get a run time error. Just
add a parenthesis on the end.

"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default summing in vba

Then post the code you have so someone can help.

"Joseph Atie" wrote:

I dont actually know the column, its going to be done inside the loop. the no
of columns is limited by the no of shifts to be worked in the program.

It needs to actually work off the 2 counters, counter 1 = column, counter 2
= row



"JLGWhiz" wrote:

I might have left a bracket off. If so you will get a run time error. Just
add a parenthesis on the end.

"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default summing in vba


FWIW:
I don't see the need for the 2nd " (the one following F2)

Sum(Range("F2":F"



"JLGWhiz" wrote:

If you know the column that you are putting the data in, for instance, column
F, then you could use:

Sub addItup()
Dim mySum As Double
mySum = WorksheetFunction.Sum(Range("F2":F" _
& Range("F65536").End(xlUp).Row)
MsgBox mySum
End Sub

That would give you the sum of the values in column F as a dynamic range,
assuming a header row.


"Joseph Atie" wrote:

im using excel to build a labour list from an ms project data file

the job im trying to do is sum column after i populate it using a pair of
for loops

so the only thing method i have of identifying the files i need to sum is
the counters of the loops.

I can do it via so more loops and an extra variable.

What i want to know is:

is there a simpler way to do it? perhaps an expression that i could use
something along the lines of:

cell.value = "=sum(counter:counter1)"

thanks in advance for any help

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 Catherine Excel Worksheet Functions 1 March 28th 07 02:09 AM
PivotTable and summing/not summing ~*Amanda*~[_2_] Excel Discussion (Misc queries) 1 March 14th 07 07:35 PM
Summing teresa Excel Programming 4 January 1st 05 03:29 AM
Summing teresa Excel Programming 5 December 8th 04 12:30 PM
Summing Kevin Excel Programming 4 October 1st 04 02:19 PM


All times are GMT +1. The time now is 06:31 PM.

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"