ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with dates (https://www.excelbanter.com/excel-programming/324209-help-dates.html)

Greg B...

Help with dates
 
Hi all

I am wondering if there is a code that I can put in to automatically place
in a cell the date of the previous Tuesday. i.e. 22 feb was the last
tuesday.

Thanks in advance

Greg



K Dales[_2_]

Help with dates
 
This worksheet formula will calculate the previous tuesday:
=TODAY()-CHOOSE(WEEKDAY(TODAY(),1),5,6,7,1,2,3,4)
If you need to convert to a value instead of the formula, you can create
code to calculate this and then store the value in the cell:
Range(DateCell).Value = Date() - Choose(Weekday(Date()),5,6,7,1,2,3,4)


"Greg B..." wrote:

Hi all

I am wondering if there is a code that I can put in to automatically place
in a cell the date of the previous Tuesday. i.e. 22 feb was the last
tuesday.

Thanks in advance

Greg




Greg B...

Help with dates
 
Thanks for the help

Greg




All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com