VBA codes fail to run automatically ~~

timesareGMT

New Member
Joined
Aug 19, 2011
Messages
26
Hi all,

I set up the VBA codes as below:

Sub AGG_CEM()
Select Case Trim(Range("e6").Value)
Case "Present"
Rows("12:24").Hidden = False
Rows("25:48").Hidden = True
Case "Absent"
Rows("12:24").Hidden = True
Rows("25:48").Hidden = False
Case Else
Rows("19:48").Hidden = False
End Select
End Sub

I plan to set it run automatically by the combo box selection, but actually it fails and I need to press ALT+F8 to get it work.

What was going wrong?

Thanks.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Your code should work just fine as it is as long as you've got your E6 value right:
Excel Workbook
E
1Present
2Absent
3Whatever
4*
52
6Absent
Sheet
In my example I have the drop down list values in E1:E3 and the drop down list changes the value in E5. E6 houses the INDEX returning the actual value that I've chosen in my drop down list.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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