Hi,
I need some guidance /help please, I have a workbook with 2 Userforms created, on the main excel workbook the user selects data from a set of drop downs, when a specific drop is selected, I wish to call a sub routine within either userform (linked to the save button in the user form.
Basically I have 2 useforms, one called 'SaveButtonAir_Click' and the other 'SaveButton_Click', if he user selects rLane = CFS Loading, then I wish to call the routine SaveButtonAir, this user from sis a simple menu for the user to input vairoies bits of data, th euser then clicks on thr save button and the user input data is saved to a worksheet called 'FormsControl Sheet', this bit works all fine.
What I'm struggling with is the actually calling of the sub routine, it fails to call it, gives me the below error message.
ANy help please of where I am going qwrong?
Ive tried to use the Application.run to cll the sub as its a private sub but is still fails
I need some guidance /help please, I have a workbook with 2 Userforms created, on the main excel workbook the user selects data from a set of drop downs, when a specific drop is selected, I wish to call a sub routine within either userform (linked to the save button in the user form.
Basically I have 2 useforms, one called 'SaveButtonAir_Click' and the other 'SaveButton_Click', if he user selects rLane = CFS Loading, then I wish to call the routine SaveButtonAir, this user from sis a simple menu for the user to input vairoies bits of data, th euser then clicks on thr save button and the user input data is saved to a worksheet called 'FormsControl Sheet', this bit works all fine.
What I'm struggling with is the actually calling of the sub routine, it fails to call it, gives me the below error message.
ANy help please of where I am going qwrong?
Ive tried to use the Application.run to cll the sub as its a private sub but is still fails
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, rMode As Range, rLane As Range, rLoading As Range
Set r = Target.Cells(1, 1) 'only check first cell
Set rMode = Range("C3")
Set rLane = Range("C4")
Set rLoading = Range("C5")
If r.Address <> rMode.Address And r.Address <> rLane.Address And r.Address <> rLoading.Address Then Exit Sub ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<
If Len(r.Value) = 0 Then Exit Sub
'Step 1 - configure
Application.ScreenUpdating = False ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Application.EnableEvents = False
Unprotect Password:="dlm"
If Target.Address = rMode.Address Then rLane.Value = "Please Select Origin..."
Shapes("RFR20").Visible = False
'ActiveSheet.CheckBoxes("RFR20").Value = xlOff
Shapes("RFR40").Visible = False
Shapes("RFR40HQ").Visible = False
Shapes("Priority20").Visible = False
Shapes("Priority40").Visible = False
Shapes("Priority40HQ").Visible = False
ActiveSheet.OLEObjects("RFR20").Object.Value = False
ActiveSheet.OLEObjects("RFR40").Object.Value = False
ActiveSheet.OLEObjects("RFR40HQ").Object.Value = False
ActiveSheet.OLEObjects("Priority20").Object.Value = False
ActiveSheet.OLEObjects("Priority40").Object.Value = False
ActiveSheet.OLEObjects("Priority40HQ").Object.Value = False
Rows("5:25").Hidden = True
Rows("79:81").Hidden = True
Rows("87:" & Rows.Count).Hidden = False
' step 2 - based on Mode, select Lane and configure
Select Case rMode.Value
Case "Air" ' -------------------------------------------------------------------------------------------- Mode = Air
Select Case rLane.Value
Case "Warsaw to New York"
rLoading.EntireRow.Hidden = False
If rLoading.Value = "CFS Loading" Then
Application.Run "SaveButtonAir_Click"
Range("C8:C10").Value = vbNullString
Range("C11:C17").Value = vbNullString
Range("C19:C21").Value = vbNullString
Range("A5").EntireRow.Hidden = True
Range("A6").EntireRow.Hidden = True
Range("A7:A8").EntireRow.Hidden = False
Range("A9:A11").EntireRow.Hidden = False
Range("A12:A16").EntireRow.Hidden = True
Range("A17").EntireRow.Hidden = False
Range("A18:A21").EntireRow.Hidden = True
Range("A23:A25").EntireRow.Hidden = True
Range("A32").EntireRow.Hidden = False
Range("A33:A76").EntireRow.Hidden = True
If Range("M29") = False Then Rows("33:76").EntireRow.Hidden = True
End If