close

I am running Excel 20003.

I created a user form that allows someone to select 3 ranges on a worksheet
(3 RefEdit controls added to a form w/ an OK button). The 3 ranges will
consist of real numbers.

When the user hits the Ok button, the macro should then assign a value to
the 3rd range selected by the user that is equal to the sum of the numbers
in the first range divided by the sum of the numbers in the 2nd range.

Creating the user form and allowing the user to select 3 different ranges
was no problem, but my macro that does the math listed above is not working
right...

I am using the formula below... Excel doesn't like my sum formula for some
reason. Can somebody please help a newbie?Range(RefEdit3).Value = Sum(Range(RefEdit1)) / (Sum(Range(RefEdit1))
Sum(Range(RefEdit2)))Thanks in advance,

TT
Maybe using application.sum() would work.

And if that didn't help, I'd check to make sure each of those ranges actually
contained single cells and the values in those cells are numeric.
tt wrote:
gt;
gt; I am running Excel 20003.
gt;
gt; I created a user form that allows someone to select 3 ranges on a worksheet
gt; (3 RefEdit controls added to a form w/ an OK button). The 3 ranges will
gt; consist of real numbers.
gt;
gt; When the user hits the Ok button, the macro should then assign a value to
gt; the 3rd range selected by the user that is equal to the sum of the numbers
gt; in the first range divided by the sum of the numbers in the 2nd range.
gt;
gt; Creating the user form and allowing the user to select 3 different ranges
gt; was no problem, but my macro that does the math listed above is not working
gt; right...
gt;
gt; I am using the formula below... Excel doesn't like my sum formula for some
gt; reason. Can somebody please help a newbie?
gt;
gt; Range(RefEdit3).Value = Sum(Range(RefEdit1)) / (Sum(Range(RefEdit1))
gt; Sum(Range(RefEdit2)))
gt;
gt; Thanks in advance,
gt;
gt; TT

--

Dave Peterson


Write a message box for one of the refedit values and see what comes up.

I tried using refedit but it gave me too masny problems.
quot;ttquot; wrote:

gt; I am running Excel 20003.
gt;
gt; I created a user form that allows someone to select 3 ranges on a worksheet
gt; (3 RefEdit controls added to a form w/ an OK button). The 3 ranges will
gt; consist of real numbers.
gt;
gt; When the user hits the Ok button, the macro should then assign a value to
gt; the 3rd range selected by the user that is equal to the sum of the numbers
gt; in the first range divided by the sum of the numbers in the 2nd range.
gt;
gt; Creating the user form and allowing the user to select 3 different ranges
gt; was no problem, but my macro that does the math listed above is not working
gt; right...
gt;
gt; I am using the formula below... Excel doesn't like my sum formula for some
gt; reason. Can somebody please help a newbie?
gt;
gt;
gt; Range(RefEdit3).Value = Sum(Range(RefEdit1)) / (Sum(Range(RefEdit1))
gt; Sum(Range(RefEdit2)))
gt;
gt;
gt; Thanks in advance,
gt;
gt; TT
gt;
gt;
gt;

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()