Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
are you using the application.worksheetfunction.sum(1,2,3,4)
method. Keith www.kjtfs.co -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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/ . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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/ |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy of excel file not showing formulal/function in the function b | Excel Discussion (Misc queries) | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
Offset function with nested match function not finding host ss. | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions | |||
Adding a custom function to the default excel function list | Excel Programming |