Code wont work anymore

oggy3000

Board Regular
Joined
Jul 13, 2011
Messages
51
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?

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
Cheers
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,517
Messages
6,179,239
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top