Complex date VBA - insert a certain weekday
On Wed, 24 Jul 2013 19:00:52 +0100, Colin Hayes wrote:
In article , Ron Rosenfeld
writes
On Wed, 24 Jul 2013 02:04:47 +0100, Colin Hayes
wrote:
On Tue, 23 Jul 2013 17:29:34 +0100, Colin Hayes
wrote:
.Value = Date + 1
I note this is putting in tomorrow's date, not today's date
but for next Tuesday, change to:
.Value = Date + 8 - Weekday(Date + 5)
Hi
Just a small follow-up to this. I used the code
Value = Date + 8 - Weekday(Date + 5)
to give an output of
30 Jul 2013
When I added some text to the code :
.Value = "Tuesday " & Date + 8 - Weekday(Date + 5)
the output becomes
Tuesday 30/07/2013.
It seems to have lost the previous formatting. Is it possible to have it
read
Tuesday 30 Jul 2103 , do you know?
Thanks again
Best Wishes
By adding the text string, you have converted the entire value into text, so the date being displayed is probably your windows regional short date (that's just a guess).
If you want to ensure the date is displayed in the cell how you want, you should format the cell appropriately.
e.g. ...
.value = Date + 8 - weekday(Date+5)
.numberformat = "dddd dd mmm yyyy"
|