#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stan Halls
 
Posts: n/a
Default date

I have 7 files and each file rep a day, what i am after is a button that when
pressed will insert the date into a cell
if we go with a monday file, if i open this file and press a button i need
the script to somehow give me the correct date for the current monday if
pressed on a monday or the next monday no matter which day after monday the
button is pressed,
any ideas

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stan Halls
 
Posts: n/a
Default date

My understanding of scripts is limited, will that work is i run it tomorow ,
will it still find the date of the next monday

"Don Guillett" wrote:

try

Sub nextmonday()
If Weekday(Date) = 2 Then
mydate = Date
Else
mydate = Date + (9 - Weekday(Date))
End If
ActiveCell = mydate
End Su

--
Don Guillett
SalesAid Software

"Stan Halls" wrote in message
...
I have 7 files and each file rep a day, what i am after is a button that
when
pressed will insert the date into a cell
if we go with a monday file, if i open this file and press a button i need
the script to somehow give me the correct date for the current monday if
pressed on a monday or the next monday no matter which day after monday
the
button is pressed,
any ideas




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
edwardpestian
 
Posts: n/a
Default date


Could I expand on this idea and have it place today's date in a specific
cell instead of the active cell. Once today's date has been placed in
the cell, it would not change until the button is pressed again.

Thanks.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=555971

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR
 
Posts: n/a
Default date

Try this mod of Don's code.......

Sub nextmonday()
If WeekDay(Date) = 2 Then
mydate = Date
Else
mydate = Date + (9 - WeekDay(Date))
End If
Range(Range("b1").Value).Value = mydate
End Sub

Put a cell address in B1 and run the macro to put the date in that cell.

Vaya con Dios,
Chuck, CABGx3



"edwardpestian" wrote:


Could I expand on this idea and have it place today's date in a specific
cell instead of the active cell. Once today's date has been placed in
the cell, it would not change until the button is pressed again.

Thanks.

ep


--
edwardpestian
------------------------------------------------------------------------
edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809
View this thread: http://www.excelforum.com/showthread...hreadid=555971


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
Insert Automatic, Non-Updating Date Stamp Ken Zenachon Excel Discussion (Misc queries) 8 January 18th 06 06:52 PM
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Adding XY days to date in cells satucha Excel Discussion (Misc queries) 1 November 25th 05 08:02 AM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM
Date Math Problem Dkline Excel Worksheet Functions 4 March 4th 05 04:11 PM


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

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

About Us

"It's about Microsoft Excel"