PDA

View Full Version : Floating box Help



renatod
10-12-2018, 05:14 PM
Hello guys, I'm new to VBA and I have been failing to accomplish an assignment, and I'd hope for some help to enlighten my way.

It would have to be a floating box, where I can input 3 values (diameter, flow, and number) then, those values would be inserted on specific worksheet cells and a fourth worksheet cell value (efficiency) needs to be displayed on the floating box

the entire math behind the fourth value (efficiency) is already made, and I would need only the floating box to display them

crossposts
https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1209966-help-drawing-floating-box
https://www.excelforum.com/excel-programming-vba-macros/1249158-help-drawing-floating-box.html

p45cal
10-13-2018, 05:08 AM
Since this is an assignment, you should be doing it and I'm not going to do it for you; but I'll give you some hints.
23014
Insert a userform in the visual basic editor and add textboxes and a command button something like above.
In the above picture, there's a button on the right with the label Button which is used to bring up the floating box. It has a macro (asdf) in a standard code-module assigned to it:

Sub asdf()
UserForm1.Show False
End Sub
The bottom box is TextBox4, the three above it are TextBox1, TextBox2 and TextBox3
There's a commmand button to the right of them whose code (in the userform's code-module) is:

Private Sub CommandButton1_Click()
TextBox4.Value = Application.Sum(TextBox1.Value, TextBox2.Value, TextBox3.Value)
Range("A1") = TextBox1.Value
Range("B2") = TextBox2.Value
Range("C3") = TextBox3.Value
End Sub
The entire math behind the value in TextBox4 is the sum of the other three textboxes.
No checks are made that they're all numbers.

That's as far as I'm going.