Marty,
There is no "Round" function in VBA.
However, you can use the Excel worksheet function this way...
Application.Round(... or Application.WorksheetFunction.Round(...
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)
"Marty" wrote in message
Hello:
I'm trying to do some simple math using the values in some textboxes, and
I'm getting an error on this statement:
Controls("TextBox" & (Y + 2)).Value = Round((Controls("TextBox" & _
(Y + 1)).Value / 100 * WORSTKG), 0)
The right side of the equation takes a value from a textbox, divides it by
100, multiples it by another variable (WORSTKG - which is a numeric value
from another textbox) and then rounds it off to a whole number and puts the
answer into a third textbox. It's part of a loop which is why the textbox
name contains a variable suffix.
At least that's the plan, but I'm getting a "type mismatch" error.
LATE NOTE: should it make a difference if I set the Controls("TextBox" & (Y
+ 1)).Value expression equal to a variable before doing the math (the way I
did WORSTKG?)? If so, why would it?
Help would be appreciated.
Thanks,
MARTY