for example:
Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("זמנת מוצרים").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
If txtName.Text = "" Then
MsgBox "Please Enter Name", vbOKOnly, "Name Error!"
Exit Sub
ElseIf txtPhone.Text = "" Then
MsgBox "Please Enter Phone", vbOKOnly, "Name Error!"
Exit Sub
ElseIf cboCourse1.Text = "" Then
MsgBox "Please Enter Number Of Products", vbOKOnly, "Name Error!"
Exit Sub
ElseIf cboCourse.Text = "" Then
MsgBox "Please Enter Product", vbOKOnly, "Name Error!"
Exit Sub
End If
If IsNumeric(txtName.Value) And txtName.Value <> vbNullString Then
MsgBox "Sorry, only TXT allowed"
txtName.Value = vbNullString
End If
If Not IsNumeric(txtName.Value) And txtName.Value <> vbNullString Then
ActiveCell.Offset = txtName.Value ---------------------------------------> this the line i get yellow in debug mode
End If
If IsNumeric(txtPhone.Value) And txtPhone.Value <> vbNullString Then
C = txtPhone.Value
ActiveCell.Offset(0, 1) = C
End If
If Not IsNumeric(txtPhone.Value) And txtPhone.Value <> vbNullString Then
MsgBox "Sorry, only numbers allowed"
txtPhone.Value = vbNullString
End If
If IsNumeric(cboCourse1.Value) And cboCourse1.Value <> vbNullString Then
Dim A As Integer
A = cboCourse1.Value
ActiveCell.Offset(0, 4) = A
End If
If Not IsNumeric(cboCourse1.Value) And cboCourse1.Value <> vbNullString Then
MsgBox "Sorry, only numbers allowed"
cboCourse1.Value = vbNullString
End If
ActiveCell.Offset(0, 2) = cboDepartment.Value
ActiveCell.Offset(0, 3) = cboCourse.Value
If optIntroduction = True Then
ActiveCell.Offset(0, 5).Value = "ינואר"
ElseIf optIntermediate = True Then
ActiveCell.Offset(0, 5).Value = "פבואר"
ElseIf Opt1 = True Then
ActiveCell.Offset(0, 5).Value = "מרץ"
ElseIf Opt2 = True Then
ActiveCell.Offset(0, 5).Value = "אפריל"
ElseIf Opt3 = True Then
ActiveCell.Offset(0, 5).Value = "מאי"
ElseIf Opt4 = True Then
ActiveCell.Offset(0, 5).Value = "יוני"
ElseIf Opt5 = True Then
ActiveCell.Offset(0, 5).Value = "יולי"
ElseIf Opt6 = True Then
ActiveCell.Offset(0, 5).Value = "אוגוסט"
ElseIf Opt7 = True Then
ActiveCell.Offset(0, 5).Value = "ספטמבר"
ElseIf Opt8 = True Then
ActiveCell.Offset(0, 5).Value = "אוקטבר"
ElseIf Opt9 = True Then
ActiveCell.Offset(0, 5).Value = "נובמבר"
Else
ActiveCell.Offset(0, 5).Value = "דצמבר"
End If
Range("A1").Select
If Not cboCourse1.Value = vbNullString And txtPhone.Value = vbNullString Then
ActiveCell.Offset(0, 2) = ""
ActiveCell.Offset(0, 3) = ""
ActiveCell.Offset(0, 5).Value = ""
End If
End Sub
Bookmarks