OverFlow

O

Otto Moehrbach

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
 
D

Don Guillett

As ALWAYS, post YOUR code for comments. Could be a dim problem
And, what's wrong with cells(1,2)=application.average(therng)
 
O

Otto Moehrbach

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
 
F

FSt1

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top