Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
OverFlow
Excel 2007, Win 7
I have the following line of code wherein I want to average the occupied cells in TheRng, and ignore the blank cells: Cells(1,2) = Application.Sum(TheRng) / Application.CountA(TheRng) I get an error with the single word "Overflow". What does that error message mean? Thanks for your time. Otto |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
OverFlow
As ALWAYS, post YOUR code for comments. Could be a dim problem
And, what's wrong with cells(1,2)=application.average(therng) -- Don Guillett Microsoft MVP Excel SalesAid Software "Otto Moehrbach" wrote in message ... Excel 2007, Win 7 I have the following line of code wherein I want to average the occupied cells in TheRng, and ignore the blank cells: Cells(1,2) = Application.Sum(TheRng) / Application.CountA(TheRng) I get an error with the single word "Overflow". What does that error message mean? Thanks for your time. Otto |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
OverFlow
Thanks Don. The problem I thought I had was that the user might place a
zero in a cell or leave it blank without giving it a thought. AVERAGE ignores the blank cells and doesn't ignore the cells that contain zeros. I got with the OP to clarify what he wants and, to my chagrin, he wants the cells summed and then divided by the count of the cells. My code would then be: Application.Sum(TheRng)/TheRng.Count I did that and I got no error. Thanks again. Otto "Don Guillett" wrote in message ... As ALWAYS, post YOUR code for comments. Could be a dim problem And, what's wrong with cells(1,2)=application.average(therng) -- Don Guillett Microsoft MVP Excel SalesAid Software "Otto Moehrbach" wrote in message ... Excel 2007, Win 7 I have the following line of code wherein I want to average the occupied cells in TheRng, and ignore the blank cells: Cells(1,2) = Application.Sum(TheRng) / Application.CountA(TheRng) I get an error with the single word "Overflow". What does that error message mean? Thanks for your time. Otto |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
OverFlow
hi
could mean that you have TheRng dimed as a integer and your average is producing decimals. could be as simple as rediming to a double. but as Don pointed out...without seeing your code (and sometimes data), we are only guessing. regards FSt1 "Otto Moehrbach" wrote: Excel 2007, Win 7 I have the following line of code wherein I want to average the occupied cells in TheRng, and ignore the blank cells: Cells(1,2) = Application.Sum(TheRng) / Application.CountA(TheRng) I get an error with the single word "Overflow". What does that error message mean? Thanks for your time. Otto . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Overflow | Excel Programming | |||
Overflow | Excel Programming | |||
Problem with overflow | Excel Programming | |||
VBA overflow | Excel Programming | |||
VBA overflow | Excel Programming |