ComboBox BackColor does not apply

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi andThanks in advance!


I have the following code whithing a macro:

Code:
Dim wCombo2 As String:        wCombo2 = Hoja04.ComboBox2.Value
Dim wCombo3 As String:        wCombo3 = Hoja04.ComboBox3.Value
  Dim pvTable As PivotTable:  Set pvTable = Hoja04.PivotTables("PT1")
Dim pvField
  If wCombo2 = wCombo3 Then
    'I am trying to apply red color to both Combos
    Hoja04.ComboBox2.BackColor = &HFF&:     Hoja04.ComboBox3.BackColor = &HFF&
    Application.ScreenUpdating = True
    MsgBox "What's Wrong's Explanation", vbCritical,"Check the Red Combos"
    Application.Wait (Now + TimeValue("0:00:2"))
    'I return the previous color to both combos, gray color
    Hoja04.ComboBox2.BackColor = &HE0E0E0: Hoja04.ComboBox3.BackColor = &HE0E0E0
    Exit Sub
  End If


This code works fine when I run my macro using F8, I mean step by step

but when using F5, If wCombo2 = wCombo3 then
I am not able to apply a red color to both combos for 2 seconds


What am I missing??
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

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