#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Timesheet


I am making a timesheet, and for each month I need a separate sheet with
the date running down column A. So in the first sheet (Called January)
A2- A32 will be 1/1/06 - 31/1/06. When I copy this sheet and rename it
February, I would like it to show the dates for this month
automatically, any way of doing this? Thanks all!


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears.

This assumes that the year of interest is entered in cell B1, A1 is available for the month name,
and A2:A32 is formatted for dates.

Change the sheet tab name, select a cell on the sheet, and then slect another cell to fire the
event.

HTH,
Bernie
MS Excel MVP


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myYear As Integer
Dim myMonth As Integer
Dim myDay As Integer

If Range("$A$1").Value = ActiveSheet.Name Then Exit Sub
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Range("$A$1").Value = ActiveSheet.Name
Range("A2:A32").ClearContents
myYear = Range("B1").Value
myMonth = Month(DateValue(ActiveSheet.Name & " 1, " & myYear))
myDay = Day(DateSerial(myYear, myMonth + 1, 0))
Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(R1C1& "" "" & Row() - 1 & "", " & myYear & """)"
Range("A2:A" & myDAys + 1).Value = Range("A2:A" & myDAys + 1).Value

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

End Sub

"ChrisMattock" wrote in message
news:ChrisMattock.2ais91_1152182703.8544@excelforu m-nospam.com...

I am making a timesheet, and for each month I need a separate sheet with
the date running down column A. So in the first sheet (Called January)
A2- A32 will be 1/1/06 - 31/1/06. When I copy this sheet and rename it
February, I would like it to show the dates for this month
automatically, any way of doing this? Thanks all!


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Timesheet


Well it adjusts for the Month, i.e. February had 28 days in it, but each
day is being displayed with an error, the top date being #VALUE! any
suggestions?


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

Did you put a valid year number in cell B1?

--
HTH,
Bernie
MS Excel MVP


"ChrisMattock" wrote in message
news:ChrisMattock.2aiyyq_1152191415.9068@excelforu m-nospam.com...

Well it adjusts for the Month, i.e. February had 28 days in it, but each
day is being displayed with an error, the top date being #VALUE! any
suggestions?


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Timesheet


Yes I have done...

=DATEVALUE($A$1& " " & ROW() - 1 & ", 2006") is the result that shows
in the formula bar, but and error appears in the cell.


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

Chris,

It might be a regional date setting...

Does

=DATEVALUE("January 1, 2006")

produce an error?


If so, what are valid strings that DATEVALUE will work with on your computer?

HTH,
Bernie
MS Excel MVP


"ChrisMattock" wrote in message
news:ChrisMattock.2aj0cp_1152193234.9335@excelforu m-nospam.com...

Yes I have done...

=DATEVALUE($A$1& " " & ROW() - 1 & ", 2006") is the result that shows
in the formula bar, but and error appears in the cell.


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Timesheet


No that doesn't work, here are some that do... (thanks a lot for all
this)


=DATEVALUE("8/22/2008")
=DATEVALUE("22-AUG-2008")
=DATEVALUE("2008/02/23")
=DATEVALUE("5-JUL")


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

Chris,

Try changing

Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(R1C1& "" "" & Row() - 1 & "", " & myYear & """)"


to

Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(Row() - 1 & "" "" & R1C1 & "" " & myYear & """)"



HTH,
Bernie
MS Excel MVP


"ChrisMattock" wrote in message
news:ChrisMattock.2aj1z1_1152195304.7639@excelforu m-nospam.com...

No that doesn't work, here are some that do... (thanks a lot for all
this)


=DATEVALUE("8/22/2008")
=DATEVALUE("22-AUG-2008")
=DATEVALUE("2008/02/23")
=DATEVALUE("5-JUL")


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

OR (since I forgot the dashes....)

Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(Row() - 1 & ""-"" & R1C1 & ""-" & myYear & """)"

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Chris,

Try changing

Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(R1C1& "" "" & Row() - 1 & "", " & myYear & """)"


to

Range("A2:A" & myDay + 1).FormulaR1C1 = _
"=DATEVALUE(Row() - 1 & "" "" & R1C1 & "" " & myYear & """)"



HTH,
Bernie
MS Excel MVP


"ChrisMattock" wrote in message
news:ChrisMattock.2aj1z1_1152195304.7639@excelforu m-nospam.com...

No that doesn't work, here are some that do... (thanks a lot for all
this)


=DATEVALUE("8/22/2008")
=DATEVALUE("22-AUG-2008")
=DATEVALUE("2008/02/23")
=DATEVALUE("5-JUL")


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817





  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Timesheet


That's awesome, thanks!


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=558817



  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Timesheet

You're welcome...

Bernie
MS Excel MVP



That's awesome, thanks!



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
displaying selected items from a yearplanner in a timesheet James Excel Discussion (Misc queries) 0 October 22nd 05 04:30 PM
How do I calculate an employee timesheet in Excel? Raven Excel Worksheet Functions 1 October 3rd 05 07:20 PM
Timesheet help kimmyrt Excel Worksheet Functions 3 March 22nd 05 04:34 AM
overtime on timesheet kimmyrt Excel Worksheet Functions 4 January 26th 05 07:33 PM
timesheet with running total of overtime kimmyrt Excel Worksheet Functions 2 January 26th 05 06:15 PM


All times are GMT +1. The time now is 04:31 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"