Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Vacation Accrued /Sick Days Accrued

This Works Fine If the Employee Starts on the First of the Year if Not I need
to consider the Start Date. G4 holds Allotted Vacation Days (10 Vacation
days) and G5 Holds Alloted Personal/Sick Days (5 Sick/Personal Days). D3 is
the End Date field.

not sure how to go about this...Confused.,....


Private Sub Workbook_Open()
Dim MyItem As Double, MyItem2 As Double, ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Activate
If IsEmpty(Range("D3").Value) Then
MyItem = Month(Now) / 12 * Range("G4").Value
Else
MyItem = Month(Range("D3").Value) / 12 * Range("G4").Value
End If
Range("G8").Value = MyItem
If IsEmpty(Range("D3").Value) Then
MyItem2 = Month(Now) / 12 * Range("G5").Value
Else
MyItem2 = Month(Range("D3").Value) / 12 * Range("G5").Value
End If
Range("G13").Value = MyItem2
Next ws
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Vacation Accrued /Sick Days Accrued

You have to subtract the start month from your curret month in the formula.


Month(Now) - month("Start Date")
or
Month(Range("D3").Value) - month("Start Date")

"O...." wrote:

This Works Fine If the Employee Starts on the First of the Year if Not I need
to consider the Start Date. G4 holds Allotted Vacation Days (10 Vacation
days) and G5 Holds Alloted Personal/Sick Days (5 Sick/Personal Days). D3 is
the End Date field.

not sure how to go about this...Confused.,....


Private Sub Workbook_Open()
Dim MyItem As Double, MyItem2 As Double, ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Activate
If IsEmpty(Range("D3").Value) Then
MyItem = Month(Now) / 12 * Range("G4").Value
Else
MyItem = Month(Range("D3").Value) / 12 * Range("G4").Value
End If
Range("G8").Value = MyItem
If IsEmpty(Range("D3").Value) Then
MyItem2 = Month(Now) / 12 * Range("G5").Value
Else
MyItem2 = Month(Range("D3").Value) / 12 * Range("G5").Value
End If
Range("G13").Value = MyItem2
Next ws
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 515
Default Vacation Accrued /Sick Days Accrued

Why not just use formulae to achieve what you want?

--
Hth

Kassie Kasselman
Change xxx to hotmail


"O...." wrote:

This Works Fine If the Employee Starts on the First of the Year if Not I need
to consider the Start Date. G4 holds Allotted Vacation Days (10 Vacation
days) and G5 Holds Alloted Personal/Sick Days (5 Sick/Personal Days). D3 is
the End Date field.

not sure how to go about this...Confused.,....


Private Sub Workbook_Open()
Dim MyItem As Double, MyItem2 As Double, ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Activate
If IsEmpty(Range("D3").Value) Then
MyItem = Month(Now) / 12 * Range("G4").Value
Else
MyItem = Month(Range("D3").Value) / 12 * Range("G4").Value
End If
Range("G8").Value = MyItem
If IsEmpty(Range("D3").Value) Then
MyItem2 = Month(Now) / 12 * Range("G5").Value
Else
MyItem2 = Month(Range("D3").Value) / 12 * Range("G5").Value
End If
Range("G13").Value = MyItem2
Next ws
End Sub

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
Length of Service and Vacation Hours Accrued WilliamsDeLisle Excel Worksheet Functions 2 April 20th 09 04:11 PM
Vacation Accrued SilviaG Excel Discussion (Misc queries) 4 June 5th 08 03:08 PM
Tracking accrued sick time with excel Jon Excel Discussion (Misc queries) 0 March 9th 08 09:03 PM
How do I add "accrued vacation days" column to the Employee Attend Jam Excel Worksheet Functions 4 February 5th 08 06:06 AM
Accrued Vacation Kim Campbell via OfficeKB.com Excel Worksheet Functions 8 January 12th 05 03:01 PM


All times are GMT +1. The time now is 03:49 PM.

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

About Us

"It's about Microsoft Excel"