Private Sub CommandButton1_Click()

    Dim lngDays As Long, lngActualDays As Long
    On Error Resume Next
    lngDays = Day(DateSerial(Year(TextBox2.Value),
Month(TextBox2.Value) + 1, 0))
    lngActualDays = lngDays - Day(DateSerial(Year(TextBox2.Value),
Month(TextBox2.Value), Day(TextBox2.Value))) + 1
    TextBox3.Value = TextBox1.Value * lngActualDays / lngDays
    If Err.Number Then TextBox3.Text = ""

End Sub

On Sat, Jan 21, 2012 at 11:23 AM, Shankar Bheema <shankar.n...@gmail.com> wrote:
> Dear Experts
>
> I am attaching an excel form, in which according to the promotion date text
> box the proportionate pay text box has to show in the command button event
> the pay of that particular month according to the days calculation.
>
> eg.  if the pay is 1000/- pm (consider every calendar month should have 30
> days only)
> suppose if the date of promotion is on 01-09-2011, the proportionate pay
> will remain 1000/- else if the date of promotion is on 02-09-2011 or
> 03-09-2011 so on... the remaining days of that particular month should be
> calculated and shown in that text box.
>
> Here if the Date of promotion is on 02-09-2011
> remaining days will be 30-1 => 29
> (1000/30) * 29 => 966.666666667
>
> regards
>
> --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
> not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
> ------------------------------------------------------------------------------------------------------
> To post to this group, send email to excel-macros@googlegroups.com



-- 
Sam Mathai Chacko

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to