Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using the Sum Function in VBA

Hello:

I am trying to use the sum function in a VBA module in an
excel 2002 worksheet. When my code runs, it seems to not
recognize the "Sum" function. Any suggestions as to why
it is not being recognized would be appreciated. Is
there a small line of code that I might be missing that
would allow me to use this or any function?

Thanks,

Theresa
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using the Sum Function in VBA

are you using the application.worksheetfunction.sum(1,2,3,4)

method.

Keith
www.kjtfs.co

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Using the Sum Function in VBA

No, I wasn't. Thank you very much. My problem now is
that it is summing incorrectly. I have looked at decimal
places etc. There is nothing else that could be adding
in that I can find anywhere. If I do a sum at the end of
the column I get 1 total, the code produces another total.

Scratching my head, totally baffled. !!!!
-----Original Message-----
are you using the application.worksheetfunction.sum

(1,2,3,4)

method.

Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using the Sum Function in VBA

I suggest setting up a loop that goes thru each cell and displays the
value in the cell you are adding, like a msgbox or just use a watch
variable... See what the cells have in them you are adding then add
them on a calculator. That should put you on the track as to what VBA
is doing also make sure the variable you are using to store the sum in
declared as in dim dblMySum as double and dblMySum = 0 .

Hope that gets you closer to your answer.

Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Not Adding Correctly!

No, I wasn't. Thank you very much. My problem now is
that it is summing incorrectly. I have looked at decimal
places etc. There is nothing else that could be adding
in that I can find anywhere. If I do a sum at the end of
the column I get 1 total, the code produces another total.

Scratching my head, totally baffled. !!!!

-----Original Message-----
are you using the application.worksheetfunction.sum

(1,2,3,4)

method.

Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Not Adding Correctly!

Theresa,

Try to gather more information on the problem.
Start by summing just one value and compare. Then two, then three etc until
you identify the cells which are contributing to the problem.

Rob

"Theresa Simpson" wrote in message
...
No, I wasn't. Thank you very much. My problem now is
that it is summing incorrectly. I have looked at decimal
places etc. There is nothing else that could be adding
in that I can find anywhere. If I do a sum at the end of
the column I get 1 total, the code produces another total.

Scratching my head, totally baffled. !!!!

-----Original Message-----
are you using the application.worksheetfunction.sum

(1,2,3,4)

method.

Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Not Adding Correctly!

Hi Theresa

You mentioned looking at decimals. Have you checked whether you've declared all your 'to-be-summed' and your sum variables as Single or Double

SuperJas.
  #8   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Using the Sum Function in VBA

Hi Theresa,
There isn't a SUM function in VBA.
You can use application.worksheetfunction.sum(1,2,3,4).

Or do it the easy way.
=1+2+3+4



--
John
johnf 202 at hotmail dot com


"Theresa Simpson" wrote in message
...
| Hello:
|
| I am trying to use the sum function in a VBA module in an
| excel 2002 worksheet. When my code runs, it seems to not
| recognize the "Sum" function. Any suggestions as to why
| it is not being recognized would be appreciated. Is
| there a small line of code that I might be missing that
| would allow me to use this or any function?
|
| Thanks,
|
| Theresa


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
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM


All times are GMT +1. The time now is 05:12 PM.

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"