Excel UserForm Data Entry (VBA) #2 - ComboBox (Drop Down List)

Описание к видео Excel UserForm Data Entry (VBA) #2 - ComboBox (Drop Down List)

Learn how to create a simple userform in Excel VBA.
This video shows how to add ComboBox Control.
The code used in this video:
Private Sub btnCancel_Click()
Unload Me
End Sub

Private Sub btnOK_Click()

Dim ws As Worksheet
Set ws = Worksheets("Customers")

Dim newRow As Long
newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1

ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
ws.Cells(newRow, 2).Value = Me.txtSurname.Value
ws.Cells(newRow, 3).Value = Me.cbCountries.Value

End Sub


Private Sub UserForm_Initialize()
With cbCountries
.AddItem "Canada"
.AddItem "New Zealand"
End With
End Sub

Комментарии

Информация по комментариям в разработке