I have a userform with buttons that open up different workbooks, with the following macros. Could someone show me an example of how to combine them all into one macro for better code efficiency? Or is this the way to do it? I have several buttons similar to this on the form.
Private Sub cmdButton1_Click()
Workbooks.Open Filename:= _
"C:\File1.xls"
Unload Me
End Sub
------------
Private Sub cmdButton2_Click()
Workbooks.Open Filename:= _
"C:\file2.xls"
Unload Me
End Sub
-------------
Private Sub cmdButton3_Click()
Workbooks.Open Filename:= _
"C:\file3.xls"
Unload Me
End Sub
-------------
Thanks!
Private Sub cmdButton1_Click()
Workbooks.Open Filename:= _
"C:\File1.xls"
Unload Me
End Sub
------------
Private Sub cmdButton2_Click()
Workbooks.Open Filename:= _
"C:\file2.xls"
Unload Me
End Sub
-------------
Private Sub cmdButton3_Click()
Workbooks.Open Filename:= _
"C:\file3.xls"
Unload Me
End Sub
-------------
Thanks!