Sub squre()
x = 0
x = InputBox("enter number")
z = x * x
MsgBox ("the Squre of " & x & " is " & z)
End Sub
ADVERTISEMENT
Hello, I have a problem similar,
Example B5 is Range2, And B3 is Range1
I have and ActiveX button on the sheet that I need to add VBA code to do the following:
When the Command button is clicked, the number entered in "B5" Range2, should be squared and the results shown in "B3" Range1
Example Range2 "B5" has 22, then when command button is clicked, Range1 "B3" should show the squared value of 484.
Private Sub CommandButton1_Click()
Range("B2").Value = Evaluate("B5^2")
End Sub
Example B5 is Range2, And B3 is Range1
[....] the number entered in "B5" Range2, should be squared and the results shown in "B3" Range1
Example Range2 "B5" has 22, then when command button is clicked, Range1 "B3" should show the squared value of 484.