Hey guys I am stuck with my code.
It was working perfectly so I started working on other features (different Userform, same file)
But now the old function does not work anymore.
I didn't change anything there, so I really cannot imagine whats wrong.
If I enter wrong values in the textfields, the MsgBoxes pop up as expected but the copying part does not happen anymore.
Any one any Idea why?
Cheers
It was working perfectly so I started working on other features (different Userform, same file)
But now the old function does not work anymore.
I didn't change anything there, so I really cannot imagine whats wrong.
If I enter wrong values in the textfields, the MsgBoxes pop up as expected but the copying part does not happen anymore.
Any one any Idea why?
Code:
Private Sub cmdTransfer_Click()
Dim lngColin, lngColout As Long
Dim objControl As Control
lngColin = Worksheets("Data In").Cells(65536, 1).End(xlUp).Row
lngColout = Worksheets("Data Out").Cells(65536, 1).End(xlUp).Row
If Me.OptionButton1.Value = True Then
If txtDate.Value = "" Then
MsgBox "Please enter date!"
Else
If txtCbm.Value = "" Or Not IsNumeric(txtCbm.Value) Then
MsgBox "Please enter CBM!"
Exit Sub
Else
If txtEntries.Value = "" Or Not IsNumeric(txtEntries.Value) Then
MsgBox "Please enter number of entries!"
Exit Sub
Else
If txtItems.Value = "" Or Not IsNumeric(txtItems.Value) Then
MsgBox "Please enter number of items!"
Exit Sub
Else
If txtShipment.Value = "" Or Not IsNumeric(txtShipment.Value) Then
MsgBox "Please enter number of Shipments!"
Exit Sub
Else
If txtWm.Value = "" Or Not IsNumeric(txtWm.Value) Then
MsgBox "Please enter w/m!"
Exit Sub
Else
If txtRemarks.Value = "Remarks" Then
txtRemarks.Value = ""
Else
Worksheets("Data In").Cells(lngColin + 1, 1) = txtDate.Value
Worksheets("Data In").Cells(lngColin + 1, 2) = txtEntries.Value
Worksheets("Data In").Cells(lngColin + 1, 3) = txtItems.Value
Worksheets("Data In").Cells(lngColin + 1, 4) = txtCbm.Value
Worksheets("Data In").Cells(lngColin + 1, 5) = "INCOMING"
Worksheets("Data In").Cells(lngColin + 1, 6) = txtWm.Value
Worksheets("Data In").Cells(lngColin + 1, 7) = txtShipment.Value
Worksheets("Data In").Cells(lngColin + 1, 8) = txtRemarks.Value
End If
End If
End If
End If
End If
End If
End If
Else
If Me.OptionButton2.Value = True Then
If txtDate.Value = "" Then
MsgBox "Please enter date!"
Else
If txtCbm.Value = "" Or Not IsNumeric(txtCbm.Value) Then
MsgBox "Please enter CBM!"
Exit Sub
Else
If txtEntries = "" Or Not IsNumeric(txtEntries.Value) Then
MsgBox "Please enter number of entries!"
Exit Sub
Else
If txtItems = "" Or Not IsNumeric(txtItems.Value) Then
MsgBox "Please enter number of items!"
Exit Sub
Else
If txtShipment = "" Or Not IsNumeric(txtShipment.Value) Then
MsgBox "Please enter number of Shipments!"
Exit Sub
Else
If txtSeal.Value = "" Or Not IsNumeric(txtSeal.Value) Then
MsgBox "Please enter number of Seals!"
Exit Sub
Else
If txtCartons.Value = "" Or Not IsNumeric(txtCartons.Value) Then
MsgBox "Please enter number of cartons!"
Exit Sub
Else
If txtWm = "" Or Not IsNumeric(txtWm.Value) Then
MsgBox "Please enter w/m!"
Exit Sub
Else
If txtRemarks.Value = "Remarks" Then
txtRemarks.Value = ""
Else
Worksheets("Data Out").Cells(lngColout + 1, 1) = txtDate.Value
Worksheets("Data Out").Cells(lngColout + 1, 2) = txtEntries.Value
Worksheets("Data Out").Cells(lngColout + 1, 3) = txtItems.Value
Worksheets("Data Out").Cells(lngColout + 1, 4) = txtCbm.Value
Worksheets("Data Out").Cells(lngColout + 1, 5) = "OUTGOING"
Worksheets("Data Out").Cells(lngColout + 1, 6) = txtWm.Value
Worksheets("Data Out").Cells(lngColout + 1, 7) = txtShipment.Value
Worksheets("Data Out").Cells(lngColout + 1, 8) = txtCartons.Value
Worksheets("Data Out").Cells(lngColout + 1, 9) = txtSeal.Value
Worksheets("Data Out").Cells(lngColout + 1, 10) = txtRemarks.Value
End If
End If
End If
End If
End If
End If
End If
End If
End If
Else
MsgBox "Please choose Incoming or Outgoing"
Exit Sub
End If
End If
MsgBox "Data transferred"
Call UserForm_Initialize
End Sub