# custom box

#### lougalea

##### New Member
Can the following equations be made in a pop up box for Excel ver.2010.Just enter a value in a entry box and the result is automatically calculated

diameter = circumference / PI
circumference = PI * diameter
circumference = PI * (radius * 2)

Cheers
Lou

### Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi and welcome to the forum.

You would need to know an initial value. The code below assumes you know the radius.

Open Excel,
Press Alt+F11.
Place the code below in the ThisWorkbook module and press F5 to run..

Code:
``````[COLOR=darkblue]Sub[/COLOR] test()
[COLOR=darkblue]Dim[/COLOR] pi [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Double[/COLOR]
[COLOR=darkblue]Dim[/COLOR] txt [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]String[/COLOR]

pi = 4 * Atn(1)
[COLOR=darkblue]If[/COLOR] r = 0 [COLOR=darkblue]Then[/COLOR]
MsgBox "Please enter a valid number!"
[COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]

[COLOR=green]'build up the output message[/COLOR]
txt = "Area = " & pi * (r ^ 2) & vbCrLf
txt = txt & "Radius = " & (2 * r) / 2 & vbCrLf
txt = txt & "Diameter = " & 2 * r & vbCrLf
txt = txt & "Circumference = " & pi * 2 * r & vbCrLf
txt = txt & "Sphere Surface Area = " & 4 * pi * r ^ 2 & vbCrLf
txt = txt & "Sphere Volume = " & (4 / 3) * pi * r ^ 3

MsgBox txt
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]``````

Hi Bertie

Thank you . That works well

Lou

Replies
3
Views
3K
Replies
5
Views
619
Replies
3
Views
586
Replies
4
Views
2K
Replies
2
Views
275

1,206,758
Messages
6,074,768
Members
446,085
Latest member
Grunter

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back