Загрузка страницы

How to: Create a simple Userform in Excel

My first tutorial showing how to create a simple user form using excel. Thanks for watching.

The code needed for the "add details" button:

Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_Name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.textbox_name.Value
ws.Cells(iRow, 2).Value = Me.textbox_surname.Value
ws.Cells(iRow, 3).Value = Me.textbox_age.Value
ws.Cells(iRow, 4).Value = Me.textbox_gender.Value

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_name.Value = ""
Me.textbox_surname.Value = ""
Me.textbox_age.Value = ""
Me.textbox_gender.Value = ""
Me.textbox_name.SetFocus

Видео How to: Create a simple Userform in Excel канала SPTutorials1
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
15 апреля 2012 г. 5:28:14
00:07:13
Яндекс.Метрика