So I have a UserForm that IÂ’m working on and have beentrying to hide/show a certain Label and Textbox based on the value of a ComboBox.
The code I am usingto do this is –
Note;
TB = TextBox
La = Label
CB = ComboBox
I have this inside of a larger set of code (below) which IÂ’musing to determine the ComboBox Values
For some reasonthough, the code above seems to causes the error in the title. It’s causing amodule I have, to ‘show’ the UserForm, to error)
As soonas I take the above code out again everything works.
PS - Sorry for the strange layout of the text – my PCdoesn’t seem to like this Forum’s message box at all !
The code I am usingto do this is –
Code:
'hide HolidayRentTB & HolidayRentLa
[FONT=Calibri]If (PropertyTypeCB.Value) = "Single Unit" Or "Ex-Pat" Or "Holiday Let / AST" Then[/FONT]
[FONT=Calibri] HolidayRentLa.Visible = False
[/FONT]
[FONT=Calibri] HolidayRentTB.Visible = False[/FONT]
[FONT=Calibri]Else[/FONT]
[FONT=Calibri] HolidayRentLa.Visible = True[/FONT]
[FONT=Calibri] HolidayRentTB.Visible = True[/FONT]
[FONT=Calibri]End If[/FONT]
Note;
TB = TextBox
La = Label
CB = ComboBox
I have this inside of a larger set of code (below) which IÂ’musing to determine the ComboBox Values
For some reasonthough, the code above seems to causes the error in the title. It’s causing amodule I have, to ‘show’ the UserForm, to error)
As soonas I take the above code out again everything works.
Code:
[FONT=Calibri]Private Sub Userform_Initialize()[/FONT]
[FONT=Calibri]'hide HolidayRentTB & HolidayRentLa[/FONT]
[FONT=Calibri]If (PropertyTypeCB.Value) = "Single Unit" Or"Ex-Pat" Or "Holiday Let / AST" Then[/FONT]
[FONT=Calibri] HolidayRentLa.Visible = False[/FONT]
[FONT=Calibri] HolidayRentTB.Visible = False[/FONT]
[FONT=Calibri]Else[/FONT]
[FONT=Calibri] HolidayRentLa.Visible = True[/FONT]
[FONT=Calibri] HolidayRentTB.Visible = True[/FONT]
[FONT=Calibri]End If[/FONT]
[FONT=Calibri]'add items to the Property Type list[/FONT]
[FONT=Calibri]With PropertyTypeCB[/FONT]
[FONT=Calibri] .AddItem"Single Unit"[/FONT]
[FONT=Calibri] .AddItem"Ex-Pat"[/FONT]
[FONT=Calibri] .AddItem"Holiday Let / HRI"[/FONT]
[FONT=Calibri] .AddItem"Holiday Let / AST"[/FONT]
[FONT=Calibri]End With[/FONT]
[FONT=Calibri]'add items to the Product Type list[/FONT]
[FONT=Calibri]With ProductTypeCB[/FONT]
[FONT=Calibri] .AddItem"Fixed"[/FONT]
[FONT=Calibri] .AddItem"Variable"[/FONT]
[FONT=Calibri]End With[/FONT]
[FONT=Calibri]'add items to the Product Term (Months) list[/FONT]
[FONT=Calibri]With ProductTermMonthsCB[/FONT]
[FONT=Calibri] .AddItem"0"[/FONT]
[FONT=Calibri] .AddItem"12"[/FONT]
[FONT=Calibri] .AddItem"24"[/FONT]
[FONT=Calibri] .AddItem"36"[/FONT]
[FONT=Calibri] .AddItem"48"[/FONT]
[FONT=Calibri] .AddItem"60"[/FONT]
[FONT=Calibri]End With[/FONT]
[FONT=Calibri]'add items to the Tax Band Applicable list[/FONT]
[FONT=Calibri]With TaxBandApplicableCB[/FONT]
[FONT=Calibri] .AddItem"Basic"[/FONT]
[FONT=Calibri] .AddItem"Higher / Additional"[/FONT]
[FONT=Calibri] .AddItem"Limited Company"[/FONT]
[FONT=Calibri]End With[/FONT]
[FONT=Calibri]'add items to the Product Fee Type list[/FONT]
[FONT=Calibri]With ProductFeeTypeCB[/FONT]
[FONT=Calibri] .AddItem "Fee%"[/FONT]
[FONT=Calibri] .AddItem "Fee£"[/FONT]
[FONT=Calibri] .AddItem"Nil"[/FONT]
[FONT=Calibri]End With[/FONT]
[FONT=Calibri]End Sub[/FONT]
PS - Sorry for the strange layout of the text – my PCdoesn’t seem to like this Forum’s message box at all !