LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Type MisMatch with Set Statement

I am getting a 'Type Mismatch Error' when I use the Set Statement in a
control of my Userform. I want to change the Enabled and BackColor
properties of certain Controls on the Userform when the Illumination ComboBox
equals certain values. I have an Array of all the Controls Names. Why am I
getting this error?

Private Sub cboIllumination_Change()

Set Fluorescents = Controls(Array("tbxBallasts", "cboBallasts",
"cboLamps1", _
"cboLamps2", "tbxLamps1",
"tbxLamps2", _
"cboOrientation1", "cboOrientation2"))

Set LEDs = Controls(Array("tbxTransformers", "cboSpacing", "tbxLEDs"))

Select Case cboIllumination

Case "Single Row T12 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control

Case "Single Row T8 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control

Case "LEDs"
For Each Control In LEDs
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmFluorescents.Controls
Control.Enabled = False
Next Control
For Each Control In Fluorescents
Control.BackColor = vbButtonFace
Next Control

End Select

'disables Estimate command button if no illumination, and visa versa
If cboIllumination = "No Illumination" Then
cmbEstimate.Enabled = False
Else
cmbEstimate.Enabled = True
End If

End Sub

Thanks in Advance,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Case when statement gives type mismatch Henrik[_6_] Excel Programming 2 June 16th 04 04:36 PM
Type mismatch while running If statement Stel Excel Programming 4 December 18th 03 09:19 AM


All times are GMT +1. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"