VB:Select Case format(now(),"dddd") Case Is "Monday" Then Set wsReport = thisworkbook.worksheets("Monday") Case Is "Tuesday" Then Set wsReport = thisworkbook.worksheets("Tuesday") etc...
I have got a spreadsheet that needs filling in by 3pm everyday. The workbook has a worksheet for each day e.g. Mon to Fri. What I am looking to do is fill the worksheets in for whatever day it is e.g. if it is monday then select monday data from required file and paste into monday worksheet. I was going to create five macros for each day and then select the required one on the day, but rather than doing this is their a way that i could write one macro that runs by checking what day it is? e.g. if monday run monday code...
Hope that makes sense.
Slighty Better approach
zVB:Sub x() 'Select the Weekday(Integer)from todays date 'using Monday as your first day of the week 'If you wanted Sunday to be your first day of the week use vbSunday & Change Case Numbers Select Case DatePart("w", Date, vbMonday) Case 1 MsgBox "Mon" Case 2 MsgBox "Tue" Case 3 MsgBox "Wed" Case 4 MsgBox "Thur" Case 5 MsgBox "Fri" Case 6 MsgBox "Sat" Case 7 MsgBox "Sun" End Select End Sub
If you wish to continue using this free service.
Please read the This Page which you agreed to when joining. In particular the point on Thread Titles. After you have done so please CLICK HERE and Private Message Dave Hawley with your acceptance, or non-acceptance of the rules. Please also include a link to this Thread. You can copy this directly from the Address bar of your Browser. When this is done your thread will be re-opened.
Please take just 3 mins of your time to read: How To Get Your Question Answered...FAST! AND Anatomy Of A Good Thread Title
There are currently 1 users browsing this thread. (0 members and 1 guests)