Code to make sure checkbox was selected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Evening.

When my userform opens i have two checkboxes.
CheckBox1 & Checkbox2

The user MUST select one of them to see another checkbox etc before pressing the command button which transfers the values to my worksheet.

Currently there is nothing in place to see if Checkbox 1 or CheckBox 2 was selected.

Please can you advise.
Thanks.

Here is the command button code.

Rich (BB code):
Private Sub TransferButton_Click()

 With ThisWorkbook.Worksheets("RANGER")
    If CheckBox3.Value = True Then .Cells(lastrow + 5, 9).Value = "N 41601-501-41": CheckBox3.Value = False
    If CheckBox4.Value = True Then .Cells(lastrow + 5, 9).Value = "N 41803-501-42": CheckBox4.Value = False
    If CheckBox5.Value = True Then .Cells(lastrow + 5, 9).Value = "V 41803-501-43": CheckBox5.Value = False
 
 
    With .Range("I5")
        .Font.Size = 14
        .Font.Name = "Calibri"
        .Font.Bold = True
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlVAlignCenter
    End With

    With Sheets("RANGER")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Cells(.Rows.Count, 5).End(xlUp).Row
        .Range("A4:I" & x).Sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess
    End With

    Unload RangerPcbNumber
    End With
    MsgBox "DATABASE UPDATED SUCCESSFULLY", vbInformation, "SUCCESSFUL MESSAGE"
End Sub
Private Sub CheckBox1_Cha
 
Please do this to see at your end.

Open Ranger Form Remote

CUSTOMER.....Enter a name
VIN.......Enter 123
YEAR..... Make a selection
TYPE.....MUST SELECT ORIGINAL 2B

Select FORD 4488516
Select 41601

NOW AT THIS POINT THE VALUES ARE ENTERED ON WORKSHEET BUT CELL I5 IS EMPTY.

New Userform is open.
Select 41601

NOW THIS IS WHERE WE NEED CODE TO MAKE SURE THE USER ALSO SELECTS NALDEC 41601-501-41

If you press TRANSFER MsgBox will say successfull BUT cell I5 is empty.
The code needed needs to show the user that the option NALDEC 41601-501-41 wasnt selected.
Once the user selects it THEN & ONLY THEN when you press TRANSFER NALDEC 41601-501-41 will be seen in cell I5
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
i have run the example. i will send back a version i have worked a bit more. we can see if it is working as you need. i think you have overcomplicated the interface a bit... the keep it simple method seems to make it easier for users.
 
Upvote 0
I have used the code in post #29

ALL works well apart from one thing.

Select 41835

You will see two options
NALDEC 41803-501-42

AND

VISTEON 41803-501-43

Selection NALDEC enters the value in cell I5

Selection VISTEON cell I5 is empty

Selection 41601 works fine.

JUST NEED TO SRT ITEM IN RED TEXT AND FINISHED
 
Upvote 0
tomorrow... i am off to bed. approaching midnight here
 
Upvote 0
I found the mistake, there was 2 x OptionButton 2 as opposed 2 and 3

I will run through the code now for a while
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

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