ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,699
- Office Version
- 2007
- Platform
- Windows
Hi,
This is the code for my form.
When the userform first opens i see the options of 41601 & 41835 neither of which are at this point selected.
Lets assume i select 41601 i now see the dot in the option button.
Ive noticed ive made a mistake & should of selected 41835
On the form i have a commandbutton2 which should call userform_initialize and then show me 41601 & 41835 like at the start.
This does happen BUT the incorrectly selected option in this case 41601 is shown as selected BUT i need neither to be selected
This is the code for my form.
When the userform first opens i see the options of 41601 & 41835 neither of which are at this point selected.
Lets assume i select 41601 i now see the dot in the option button.
Ive noticed ive made a mistake & should of selected 41835
On the form i have a commandbutton2 which should call userform_initialize and then show me 41601 & 41835 like at the start.
This does happen BUT the incorrectly selected option in this case 41601 is shown as selected BUT i need neither to be selected
Rich (BB code):
Private Sub CommandButton1_Click()
With ThisWorkbook.Worksheets("RANGER")
If OptionButton3.Value = True Then .Cells(lastrow + 5, 9).Value = "N 41601-501-41": OptionButton3.Value = False
If OptionButton4.Value = True Then .Cells(lastrow + 5, 9).Value = "N 41803-501-42": OptionButton4.Value = False
If OptionButton5.Value = True Then .Cells(lastrow + 5, 9).Value = "V 41803-501-43": OptionButton5.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 HAS BEEN UPDATED", vbInformation, "SUCCESSFUL MESSAGE"
End Sub
Private Sub CommandButton2_Click()
Call UserForm_Initialize
End Sub
Private Sub OptionButton1_Change()
If OptionButton1.Value = True Then
OptionButton2.Visible = False
OptionButton3.Visible = True
End If
End Sub
Private Sub OptionButton2_Change()
If OptionButton2.Value = True Then
OptionButton1.Visible = False
OptionButton4.Visible = True
OptionButton5.Visible = True
End If
End Sub
Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
OptionButton4.Visible = False
OptionButton5.Visible = False
End If
End Sub
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
OptionButton3.Visible = False
End If
End Sub
Private Sub OptionButton4_Click()
If OptionButton4.Value = True Then
OptionButton5.Visible = False
End If
End Sub
Private Sub OptionButton5_Click()
If OptionButton5.Value = True Then
OptionButton4.Visible = False
End If
End Sub
Private Sub UserForm_Initialize()
OptionButton1.Visible = True
OptionButton2.Visible = True
OptionButton3.Visible = False
OptionButton4.Visible = False
OptionButton5.Visible = False
End Sub