ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   date (https://www.excelbanter.com/excel-worksheet-functions/96259-date.html)

Stan Halls

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


Don Guillett

date
 
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




Stan Halls

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





Don Guillett

date
 
why don't you try it and then ask.

--
Don Guillett
SalesAid Software

"Stan Halls" wrote in message
...
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







Stan Halls

date
 
I will , thanks for you help,

"Don Guillett" wrote:

why don't you try it and then ask.

--
Don Guillett
SalesAid Software

"Stan Halls" wrote in message
...
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








Stan Halls

date
 
Magic, thanks for you help on this

"Stan Halls" wrote:

I will , thanks for you help,

"Don Guillett" wrote:

why don't you try it and then ask.

--
Don Guillett
SalesAid Software

"Stan Halls" wrote in message
...
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








edwardpestian

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


CLR

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



Don Guillett

date
 
Or if you just want it in cell b1

Range("b1").Value = mydate

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...
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






All times are GMT +1. The time now is 12:30 PM.

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