How to display multiple variables in a pop-up prompt in Excel VBA (UserForm? Msgbox? Dialog Box?)

I have a VBA code where I compute the values of many variables (For simplicity, let's name them A, B, C). I need to be able to pop up a prompt that would look a little more professional and involved than using a MsgBox with multiple vbLines. For example, to have a frame that holds three boxes, each one displaying the value of one of the variables, and has a caption in it.

How can I do that? MsgBox, although a great tool, seems too limited for this task. I tried to figure out using a UserForm, but the controls available for UserForms are all Comboxoes, Listboxes, etc. Can I not insert simple "Display Boxes" in a user form?

Furthermore, I will eventually need to have an additional box in that pop-up prompt where the user enters some value, clicks OK, then the value of the variables A,B,C are re-computed and updated in the display.

Can someone just point me to what tool I need to use? (Msgbox? dialogbox? userform? etc). Of course, reference links with tutorials would certainly help, but just names and directions will also help.

Thanks, Alaa

Answers


A userform is the way to go. You can display your variables in either labels or textboxes. You can group them using a Frame control. If the user-entered value is from a limited set, I'd go with a combobox, with MatchRequired set to true and calculation done on its Click event. If they can enter anything, then I'd use a textbox for that.


Need Your Help

SKNodes in SKScene moving in the wrong direction

ios swift tiled jstilemap

I am implementing a one dimension movement along the x axis.