English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

what should i type in VBA so that it can do math calculations and show the results in a box. for example i want to type a ramdon number in a box then press a button and it will divide it by 15 then add 100 to it and show the result in a box

2007-09-17 08:18:31 · 2 answers · asked by Anthony 2 in Computers & Internet Programming & Design

2 answers

If you want it to round the number:

Dim theValue As Integer
Dim theRow , theColumn As Integer
'set theRow and theColumn to the cell you want to look at here
theValue = Cells(theRow, theColumn).Value
theValue = theValue / 15 + 100
MsgBox theValue, vbOKOnly, "[Insert Title Here]"

If you don't want it to round, replace "Dim theValue As Integer" with "Dim theValue As Double"

2007-09-17 08:29:43 · answer #1 · answered by Thee John Galt 3 · 0 0

in excel, you can put a formula in a box.

=B2/15+100

2007-09-17 15:51:32 · answer #2 · answered by Computer Guy 7 · 0 0

fedest.com, questions and answers