VBA Userform Help

Asevens

New Member
Joined
Mar 17, 2015
Messages
28
Trying to get my userform to behave properly.
Have two option buttons in frame but I want them to be unavailable unless Checkbox value is true.

Based on my research so far, what I have should work but alas it does not. I am still very green with VBA and could use some help.

Code:
Public Sub Workbook_Open()
    UserForm1.Show
End Sub




Private Sub UserForm_Initialize()
    NSN.Value = ""
    LocalAsset.Value = ""
    With CarrierCombo
    .AddItem "CMTT"
    .AddItem "Day & Ross"
    .AddItem "Delivered"
    .AddItem "DHL"
    .AddItem "FedEx"
    .AddItem "Hand Delivery"
    .AddItem "Loomis"
    .AddItem "Pick-Up"
    .AddItem "Purolator"
    .AddItem "Pylon"
    .AddItem "Speedy Messenger"
    .AddItem "UPS"
    End With
    CarrierWaybill.Value = ""
    Receiver.Value = ""
    Sender.Value = ""
    With ExportControl
    .TextAlign = fmTextAlignCenter
    .TripleState = False
    End With
    
End Sub


Private Sub ExportControl_Click()
If ExportControl.Value = True Then
    Frame1.Enabled = True
Else
If ExportControl.Value = False Then
    Frame1.Enabled = False
End If
End If


End Sub
Private Sub Frame1_Change()
If Frame1.Enabled = True Then
    Canada.Enabled = True
    US.Enabled = True
Else
If Frame1.Enabled = False Then
    Canada.Enabled = False
    US.Enabled = False
End If
End If
End Sub

Thats what I have so far. I honestly dont know if I am doing anything correctly. Any help is appreciated.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try this out for your checkbox click

Code:
Private Sub ExportControl_Click()
If ExportControl.Value = True Then
Frame1.Enabled = True
ElseIf ExportControl.Value = False Then
Frame1.Enabled = False
End If
End Sub
 
Upvote 0
Still allows me to click an OB without changing the status of the checkbox.

This whole VBA set is causing me headaches to no end. Having to learn a whole new language just to set up a group with a temporary situation is proving quite a hassle, but I trudge on.
 
Upvote 0
Add this to the Initialize event
Code:
   Me.Frame1.Enabled = False
And use this for your checkbox
Code:
Private Sub ExportControl_Click()
Me.Frame1.Enabled = Me.ExportControl
End Sub
 
Upvote 0
Ah, that does the trick Fluff. Thank you.

Now I am on to the rest of the project.

Thank you Very MUCH.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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