Easy one for you lot paste current day of week into cell

Luke1690

Board Regular
Joined
Jul 26, 2022
Messages
106
Office Version
  1. 2016
Platform
  1. Windows
I'm using this code to tell me what day of the week it is, as you can see by the code it shows up with a message box. i want it to paste the current weekday into a specific cell. so when clicked Tue would populate. or whatever day it was.
Sub TodaysDay()

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
 
Remove the 'Sub day()' part

The sheet module reacts to the line:
VBA Code:
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Once the line 'Sub day()' line has been removed, go to the relevant sheet and double click cell D11
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Just put the code I posted (untouched) into the sheet module you want it to work on. Right click the sheet tab & select view code then paste the macro into the window that opens up. Then double click on D11
 
Upvote 0
Remove the 'Sub day()' part

The sheet module reacts to the line:
VBA Code:
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Once the line 'Sub day()' line has been removed, go to the relevant sheet and double click cell D11
i understand thank you. unfortunately it still didn't work when i double click d11 nothing happend.
i put the code in workbook and the worksheet and a module still didnt work?
thanks
 
Upvote 0
Delete that code from the entire workbook & then follow my instructions in post#12
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

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