date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
try

Sub nextmonday()
If Weekday(Date) = 2 Then
mydate = Date
Else
mydate = Date + (9 - Weekday(Date))
End If
ActiveCell = mydate
End Su
 
My understanding of scripts is limited, will that work is i run it tomorow ,
will it still find the date of the next monday
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top