Forum Discussion

JoeCavasin's avatar
JoeCavasin
Brass Contributor
Jan 20, 2025
Solved

VBA: Input Box vs User Form Capabilities

Seeking advice on which of the title items seems like the most appropriate option for the criteria below.

Preface also to say lots of folks on here have been incredibly helpful with all the VBA questions.  Also, i'm quickly realizing as much as i enjoy trying to learn this stuff, it would probably be a full time job to learn just what i want to do...  it's amazing what all can be done with these tools - so big thanks to everyone who has contributed, including HansVogelaar especially!

This template has team overview tab ("User List") which houses basic info required for workbook operation.  And, as the users have varying levels of skill with excel, I'm seeing the best method to keep this functioning as intended is probably to force some actions in a given path, as opposed to allowing users to update as desired - as that allows inconsistencies and errors result.  So my hope is to accomplish the following:

On Opening sheet:

Q1: Ask user if any new users to the team?

Yes - request Employee ID, User Name, Start Date.  On completion - More new users?

Yes - repeat New User Info intake.  No - move to next Question

No - move to next Question

Q2: Are any users leaving your team this month?

Yes - Departing User Info Required: User ID, End Date.   On completion: More users leaving?

Yes - repeat Leaving User info intake.  No - move to next Question

All information received from "yes" answers should be added to the table as a new row "User List".  Shot for reference here:

If the user answers No to both Q1 and Q2, then the intake method should cease, and user can move to whatever task they need to accomplish next.

Is this flow more easily accomplished or more well suited to a User Form or a series of Input Boxes?  Started tryin to develop both, and realized I should ask the experts before I chase either too far.

-Joe   

  • Since users have to enter multiple items for each new or leaving user, I'd use a userform with text boxes to enter the information and command buttons to save the current information and to start over.

3 Replies

  • Since users have to enter multiple items for each new or leaving user, I'd use a userform with text boxes to enter the information and command buttons to save the current information and to start over.

    • JoeCavasin's avatar
      JoeCavasin
      Brass Contributor

      Great, thanks again as always!

      Started building a user form, and just curious if user forms allow logic or triggers (for lack of a better word) which presents them on opening the workbook, so users are directed there first by default? 

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        Yes:

        In the Visual Basic Editor, in the Project Explorer pane on the left hand side, double-click ThisWorkbook under Microsoft Excel Objects.

        Copy the following code into the ThisWorkbook module, and if necessary, replace UserForm1 with the real name of your userform.

        Private Sub Workbook_Open()
            UserForm1.Show
        End Sub

         

Resources