Forum Discussion
Possible for UserForm to Output to Multiple Sheets?
Ben,
Here are some more detailed instructions to understand how VBA can work with UserForms.
1. Use Alt + F11 to access the Visual Basic Editor (VBE)
2. Insert > Module
3. In the module put this code:
Sub LaunchForm() UserForm1.Show End Sub
4. Insert > UserForm
5. Add a textbox and a commandbutton to the userform face
6. Double click the command button on the userform
7. Insert this code into the userform module (Make sure it looks like the images besides the custom colors I have added... your screen will be white like a blank canvas)
Private Sub CommandButton1_Click() 'When you double click through the commandbutton Excel will 'automatically make the sub procedure which runs when you 'Click the button... in this case it selects different sheets 'but you can make it do whatever you want..... If Me.TextBox1.Value = "Sheet1" Then Sheets("Sheet1").Activate ElseIf Me.TextBox1.Value = "Sheet2" Then Sheets("Sheet2").Activate Else Sheets("Sheet3").Activate End If End Sub
8. Go back to the Excel worksheet
9. Insert a Shape
10. Right Click the shape > Assign Macro
11. Assign the LaunchForm Macro to the shape
12. Now when you click on the shape your userform will pop up.
13. Type the sheet name into the textbox and press the commandbutton. This will activate the sheet you have typed. This is just a simple example. You can change the code to meet your needs.
I apologize for the late response. Thank you for this! Let me play around with it and see if this will do what I'm trying to accomplish. Thank you!!
Ben
- Matt MickleMay 24, 2018Bronze Contributor
Ben-
Sure thing. Take your time. Please feel free to follow up with any questions that come up. Always happy to help!