Excel VBA UserForm Programming Part 2

preview_player
Показать описание
In Part 2 we look at putting the code behind our UserForm to give it some use.

Code for the Submit button:

Private Sub submitBTN_Click()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Dim choice As Integer
Dim newRow As Long
newRow = Application.WorksheetFunction.CountA(ws.Range("B:B")) + 2

If depositOPT = False And withdrawOPT = False Then
MsgBox "Select an option: Deposit or Withdraw"
Exit Sub
End If

If depositOPT = True Then
choice = 3
End If

If withdrawOPT = True Then
choice = 4
End If

End Sub

If you're reading this far, I've added some more lines of code to clear the text boxes and the option buttons.
Рекомендации по теме
visit shbcf.ru