Code to make sure checkbox was selected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,935
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
 

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,935
Office Version
  1. 2007
Platform
  1. Windows
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
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,299
Office Version
  1. 2010
Platform
  1. Windows
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.
 

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,935
Office Version
  1. 2007
Platform
  1. Windows
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
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,299
Office Version
  1. 2010
Platform
  1. Windows
tomorrow... i am off to bed. approaching midnight here
 

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,935
Office Version
  1. 2007
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,129,800
Messages
5,638,425
Members
417,025
Latest member
MusterDuster

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
Top