Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Help with dates

Thanks for the help

Greg


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
Stop dates from showing as numbers - when formated as dates JR Excel Discussion (Misc queries) 1 October 29th 08 04:38 PM
Toggle a range of Julian dates to Gregorian Dates and Back PSKelligan Excel Programming 4 May 8th 07 05:51 AM
Identifying unique dates within a range of cells containing dates cdavidson Excel Discussion (Misc queries) 0 October 12th 06 08:19 PM
Charting data against dates where dates are not at fixed intervals PK Charts and Charting in Excel 4 June 16th 05 05:08 AM


All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"