Run Time error 13, Type Mismatch error - On 'Set Visable' VBA code - Help!

phil-007

New Member
Joined
May 14, 2013
Messages
32
Hi All,

I have a Form with a Combo box on that when a user selects an option I want it to show another combo box that opens a calander.

I'm having trouble with getting the second combo box to appear when I make the selection in the first box.

I've found some code which I've put in, but I now get the error "Run Time Error 13, Type Mismatch" when I choose my option from the first combo box, the code I'm using is below.

The combo box I am choosing from is titled 'Report Title' When a user chooses 'Average Weekly Usage' from this I want the comobo box 'Start Date' to appear:

The Debug error is highlighting the line "For Each varItm In Me.Report_Title.Value" if that helps?


Private Sub Report_Title_AfterUpdate()
Call SetVisible
End Sub
Private Sub SetVisible()
Dim varItm As Variant
Dim blnVisible As Boolean

blnVisible = False
If Not IsNull(Me.Report_Title.Value) Then
For Each varItm In Me.Report_Title.Value
If varItm = "Average Weekly Usage" Then
blnVisible = True
Exit For
End If
Next varItm
End If
Me.Start_Date.Visible = blnVisible
End Sub

Many Thanks

Phil
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about:
Code:
If Me.Report_Title.Value = "Average Weekly Usage" Then
    blnVisible= True
End If

I don't think it's possible to "loop" a combobox value - it's not a collection of items (the items in the combobox might be but that's not the same thing as the value of the combobox).
 
Upvote 0

Forum statistics

Threads
1,221,517
Messages
6,160,266
Members
451,635
Latest member
nithchun

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