Time sheet in Excel (help!)

G

Guest

I am making a timesheet. I have most of the functions figured out. My boss
wants the date entered to automatically enter the quarter it corresponds
with..and I don't know if excel can do that. Maybe it can? Also, if it works
in Access, that would be okay too. Anyways, an example: if someone entered
11/01/07 the next column should automatically enter 4th quarter 2007. If
someone enters 4/21/09, it should enter 2nd quarter 2009.

Another thing I need to do is take about 10 individual time sheets and put
them into one big database timesheet. Can I do that in Access?? Any help is
appreciated. Thank you!

-Coralee
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit
Dim aryQtrs


On Error GoTo ws_exit
Application.EnableEvents = False

aryQtrs = Array("1st Qtr ", "2nd Qtr ", "3rd Qtr ", "4th Qtr ")
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsDate(.Value) Then
.Offset(0, 1).Value = aryQtrs(((Month(.Value) + 2) \ 3) +
(LBound(aryQtrs) = 0)) & Year(.Value)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
P

Pete_UK

Try this formula, if your date is in A1:

="Q"&INT(MONTH(A1)/3)+1&", "&TEXT(YEAR(A1),"0000")

It will return values like "Q4, 2007" as an example. Copy down as
required.

Hope this helps.

Pete
 
G

Guest

Thanks Pete. I tried that..my date is in C1...so do I just change the "A1s"
to "C1s"?
 

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

Top