Hi everyone,
I have a spreadsheet with a form that has a dropdown list with a number of options. Underneath the dropdown box are 5 checkboxes. Depending on the choice from the dropdown, certain checkboxes are disabled. After lots of trial and error, the only way I can get it to sort of work is via the following code.
The issue I am having is, sometimes the choice from the dropdown list is not showing the correct number of disabled checkboxes. E.G. If I choose DB Report immediately after loading the form all the checkboxes are enabled, but if I then switch to another option on the dropdown and then back to DB reports the correct checkboxes are disabled!
Any ideas on how I can better code this form?
Appreciate any help.
p.s. I am a novice VBA coder so please go easy on me.
Thanks
Neil
I have a spreadsheet with a form that has a dropdown list with a number of options. Underneath the dropdown box are 5 checkboxes. Depending on the choice from the dropdown, certain checkboxes are disabled. After lots of trial and error, the only way I can get it to sort of work is via the following code.
Code:
'Please Select
If cboReport.Value = "Please Select" Then
chkCashflow.Enabled = False
chkInvestment.Enabled = False
chkPension.Enabled = False
chkIncome.Enabled = False
chkComplex.Enabled = False
End If
'Investment EAR
If cboReport.Value = "Investment EAR" Then
chkInvestment.Enabled = False
chkPension.Enabled = True
chkCashflow.Enabled = True
chkIncome.Enabled = True
chkComplex.Enabled = True
End If
'Pension EAR
If cboReport.Value = "Pension EAR" Then
chkInvestment.Enabled = True
chkPension.Enabled = False
chkCashflow.Enabled = True
chkIncome.Enabled = True
chkComplex.Enabled = True
End If
'Cashflow / DB Report / New Pension / Cash Top Ups /
If cboReport.Value = "Cashflow" Or cboReport.Value = "Cashflow Update/LFR" Or cboReport.Value = "New Pension (Simple)" Or cboReport.Value = "Top Up Report" Or cboReport.Value = "Cash Report (New Client)" Then
chkCashflow.Enabled = False
chkIncome.Enabled = True
chkInvestment.Enabled = False
chkPension.Enabled = False
chkComplex.Enabled = True
End If
'Withdrawals / Protection
If cboReport.Value = "Withdrawal Letter" Or cboReport.Value = "Protection" Then
chkCashflow.Enabled = False
chkIncome.Enabled = False
chkInvestment.Enabled = False
chkPension.Enabled = False
chkComplex.Enabled = True
End If
'Ad Hoc / Income / Annual Review / Estate Planning
If cboReport.Value = "Income Report" Or cboReport.Value = "Ad Hoc Report" Or cboReport.Value = "Annual Review" Then
chkCashflow.Enabled = True
chkIncome.Enabled = True
chkInvestment.Enabled = True
chkPension.Enabled = True
chkComplex.Enabled = True
End If
'Tax Led
If cboReport.Value = "Tax Led" Or cboReport.Value = "Trust Report" Then
chkCashflow.Enabled = False
chkIncome.Enabled = False
chkInvestment.Enabled = True
chkPension.Enabled = False
chkComplex.Enabled = True
End If
'Drawdown Review / Addendum Letter / Change of Risk
If cboReport.Value = "Drawdown Review" Or cboReport.Value = "Addendum Letter" Or cboReport.Value = "Change of Risk" Or cboReport.Value = "SSAS Review" Then
chkCashflow.Enabled = False
chkIncome.Enabled = False
chkInvestment.Enabled = False
chkPension.Enabled = False
chkComplex.Enabled = True
End If
The issue I am having is, sometimes the choice from the dropdown list is not showing the correct number of disabled checkboxes. E.G. If I choose DB Report immediately after loading the form all the checkboxes are enabled, but if I then switch to another option on the dropdown and then back to DB reports the correct checkboxes are disabled!
Any ideas on how I can better code this form?
Appreciate any help.
p.s. I am a novice VBA coder so please go easy on me.
Thanks
Neil