tjdickinson
Board Regular
- Joined
- Jun 26, 2021
- Messages
- 61
- Office Version
- 365
- Platform
- Windows
Hi, all, I'm new to VBA coding and, of course, trying an ambitious project (creating my own gradebook in Excel). I haven't got the time to go through an entire VBA course, so I'm turning to the experts for help. While I have a bit of general coding experience (mostly HTML), I'm an absolute novice at VBA, so please forgive my inaccuracies.
The first question is this:
I have a userform with three buttons: 'Add_Eval_Add' (adds the evaluation, then clears the form so a new evaluation can be added), 'Add_Eval_Close' (adds the evaluation, then closes the form), 'Cancel_New_Eval' (closes the form without adding an evaluation). The buttons are coded and working as expected.
The code for 'Add_Eval_Close' is, however, copied and pasted from 'Add_Eval_Add', with the additional line 'Unload Me' tacked on the bottom. I would like, instead, to have this button reference the code for 'Add_Eval_Add', and then run the 'Unload Me' command, so that I only need to make changes in one part of the code. So, something like:
Any ideas?
The first question is this:
I have a userform with three buttons: 'Add_Eval_Add' (adds the evaluation, then clears the form so a new evaluation can be added), 'Add_Eval_Close' (adds the evaluation, then closes the form), 'Cancel_New_Eval' (closes the form without adding an evaluation). The buttons are coded and working as expected.
The code for 'Add_Eval_Close' is, however, copied and pasted from 'Add_Eval_Add', with the additional line 'Unload Me' tacked on the bottom. I would like, instead, to have this button reference the code for 'Add_Eval_Add', and then run the 'Unload Me' command, so that I only need to make changes in one part of the code. So, something like:
VBA Code:
Private Sub Add_Eval_Close_Click ()
Run Add_Eval_Add_Click ()
Unload Me
End Sub
Any ideas?