Select Case - Based on Date:

m0atz

Board Regular
Joined
Jul 17, 2008
Messages
247
Afternoon all,

Just require a wee bit of help with the following code. It sits in the "This Workbook" code window to run each time the wbook is opened. What I want it to do, is based on the date in Sheets("Control").Range("L3") select a particular cell in another sheet called "Risk Sum". I'm assuming this is easy to do, I've come up with the following, but it just doesnt want to work...!! :)

Private Sub Workbook_Open()
Dim mth
Dim control_date
control_date = Worksheets("Control").Range("L3")
Sheets("Risk Sum").Select
Select Case mth
Case control_date = "*/01/*": Range("risksum_jan").Activate
Case control_date = "*/02/*": Range("risksum_feb").Activate
Case control_date = "*/03/*": Range("risksum_mar").Activate
Case control_date = "*/04/*": Range("risksum_apr").Activate
Case control_date = "*/05/*": Range("risksum_may").Activate
Case control_date = "*/06/*": Range("risksum_jun").Activate
Case control_date = "*/07/*": Range("risksum_jul").Activate
Case control_date = "*/08/*": Range("risksum_aug").Activate
Case control_date = "*/09/*": Range("risksum_sep").Activate
Case control_date = "*/10/*": Range("risksum_oct").Activate
Case control_date = "*/11/*": Range("risksum_nov").Activate
Case control_date = "*/12/*": Range("risksum_dec").Activate
End Select
End Sub

Can someone suggest something a little tidier / more importantly something that works!!

Cheers

Colin
 
Guys

Legendary work as every - much appreciated, and now alot clearer on what things mean.

Have a nice day...and Happy Christmas!!

Cheers

Colin
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,216,550
Messages
6,131,304
Members
449,642
Latest member
jobon

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