Thread: Help with dates
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default 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