Automatic Day of the week.

Luke1690

Board Regular
Joined
Jul 26, 2022
Messages
106
Office Version
  1. 2016
Platform
  1. Windows
Someone kindly give me this code yesterday so when i double click D11 it buts the day of the week in the cell in this format ddd.

Private Sub WORKSHEET_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address(0, 0) = "D11:J11" Then
Cancel = True
Target.Value = Format(Date, "ddd")
End If
End Sub

it works perfectly on one workbook but i cant seem to get it to work on multiple.
is there a macro or a way i can change this code so its not double click the cell but a button pressed to fill the current day in.
or can someone explain why it wont work on multiple workbooks?

Again, im not an expert so might need to explain.

Thanks Guys
 

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.
You said:
multiple workbooks

Are you sure you mean workbook or do you mean Worksheet
 
Upvote 0
You said:
multiple workbooks

Are you sure you mean workbook or do you mean Worksheet
yes i mean Multiple Workbooks, when i copy the code and place it into another workbook into sheet1 it doesn't work for some reason.
 
Upvote 0
yes i mean Multiple Workbooks, when i copy the code and place it into another workbook into sheet1 it doesn't work for some reason.
I cannot get it to work on My workbook.

Tell me what you're attempting to do.
When you double click on what range do you want Todays Date entered.
 
Upvote 0
I cannot get it to work on My workbook.

Tell me what you're attempting to do.
When you double click on what range do you want Todays Date entered.
Thankyou

So ive got muiltple workbooks that are used to order items. They are filled in and sent as an attachment to a different department.
i want to make as much automatic as possible, so i have made a code that fills the current time in when clicked.
Now i want to have a button to fill the day in in this format (ddd)
i have merged cells together where i want the day to show, the cell is D11 but merged to J11
 
Upvote 0
Thankyou

So ive got muiltple workbooks that are used to order items. They are filled in and sent as an attachment to a different department.
i want to make as much automatic as possible, so i have made a code that fills the current time in when clicked.
Now i want to have a button to fill the day in in this format (ddd)
i have merged cells together where i want the day to show, the cell is D11 but merged to J11
not date more day of week so Mon,Tue,Wed,thu........
 
Upvote 0
Working with Merged cells is very difficult and on this forum you will see a lot of cases where users are told it's best to not use merged cells.

And now it sounds like you want more then one date entered. You said

not date more day of week so Mon,Tue,Wed,thu........

And this can be done with a button.
So tell me exactly what and where you want Days of the week entered.

So do you want Mon entered in Range("A1") and "Tues" entered in "B1" and so on till Sun
 
Upvote 0
not date more day of week so Mon,Tue,Wed,thu........
i have both workbooks open at the moment this code is pasted in both workbooks in Sheet1
Working with Merged cells is very difficult and on this forum you will see a lot of cases where users are told it's best to not use merged cells.

And now it sounds like you want more then one date entered. You said

not date more day of week so Mon,Tue,Wed,thu........

And this can be done with a button.
So tell me exactly what and where you want Days of the week entered.

So do you want Mon entered in Range("A1") and "Tues" entered in "B1" and so on till Sun
sorry ill try and make it more clear.

so i have three order forms saved as below;

WORKBOOK1- SHEET1 - (A11) has a Title of DAY next to that a blank cell (B11) i want the current day to appear in format (WED) when a button is pressed.

WORKBOOK2- SHEET1 - (A11) has a Title of DAY next to that a blank cell (B11) i want the current day to appear in format (WED) when a button is pressed.

WORKBOOK3- SHEET1 - (A11) has a Title of DAY next to that a blank cell (B11) i want the current day to appear in format (WED) when a button is pressed.

I hope that makes more sense, i only need the current day entered once on each workbook, these workbooks are used multiple times a day to order items. so tomorrow when they are opened and the button is pressed (THU) will appear.

i understand merging cells makes it more difficult but the code i was given works on one just not on the other workbooks. if you can supply something to work for the above cells, i will mess around with it to get it to work on my merged cells.

The actual merged cells are Title DAY A11:C11 / BLANK CELL D11:J11
 
Upvote 0
This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Upvote 0
This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
Okay,
Thankyou for your input.

Again this code works on 1 workbook but not on the other 2

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address(0, 0) = "D11:J11" Then
Cancel = True
Target.Value = Format(Date, "ddd")
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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