INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

need to make a small project in vb for employee income and tax calculator

need to make a small project in vb for employee income and tax calculator

need to make a small project in vb for employee income and tax calculator

(OP)
Hello all i need to mak

RE: need to make a small project in vb for employee income and tax calculator

(OP)
i have t caculate it on annual basis and want to code it so that it can show the highest salary person and the lowest salary employee also so how can i do these two things too.

RE: need to make a small project in vb for employee income and tax calculator

HI,

What application are you coding in?

This does not look like VBA.

What is this literal???

CODE

If salaryAmount >= 10600D The 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
i just want to only coding no form building thanks.

RE: need to make a small project in vb for employee income and tax calculator

Please answer my specific questions.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
If salaryAmount >= 10600 The

you asking about abo tax of 25 percent.

RE: need to make a small project in vb for employee income and tax calculator

Quote:

What application are you coding in?
This is Visual Basic for APPLICATIONS, like Excel, Word, Outlook etc.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
yes i want to code it in VB so can you help me thanks.

RE: need to make a small project in vb for employee income and tax calculator

VB is a LANGUAGE.

This forum is for VBA, not VB.

So you need to determine, what kind, like VB Net or VB version 6 or ??? Neither of these VBs are addressed in this forum.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
i need coding in VBA so can you code it now please.

RE: need to make a small project in vb for employee income and tax calculator

What APPLICATION are you coding your VBA in?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
just want to code a small rcent.

RE: need to make a small project in vb for employee income and tax calculator

Quote:

just want to code a small application in exe...

You don't code in exe. An exe is a compiled executable. It's what is generated from code like VB.

That is NOT what happens with VBA! You do not generate an exe.

Again, what APPLICATION are you running in which you need to code VBA? Excel? Word? Outlook? Access?

Which one???

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
IN MS EXCEL I WANT TO CODE THE APPLICATION.

RE: need to make a small project in vb for employee income and tax calculator

Thank you.

So what happens to your code when you, in the VBA Editor, try to Debug > Compile VBAProject

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
I AM GETTING ERROR I AM USING THESE CODE MAY BE I AM WRONG IN CODING AS ITS INCOMPLETE ALSO CAN YOU CORRECT IT ACCORDING TO MY NEEDS PLEASE.

Private Sub CalculateDisplayAmounts(ByVal salary As Decimal)
Dim taxRate

RE: need to make a small project in vb for employee income and tax calculator

Okay, but we need to establish some things.

Where is the source data for employees and salary located?

Do you have test data in a workbook that can be used to validate design and coding?

What procedure calls CalculateDisplayAmounts?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

Additionally, if you could upload a version of your spreadsheet with dummy data, it might help as well.

RE: need to make a small project in vb for employee income and tax calculator

So here's some VBA, using your original code, to get you started.

CODE

Private Sub CalculateDisplayAmounts(ByVal salary As Currency)
    Dim taxRate As Single
    Dim taxAmount As Currency
    Dim takeHomePay As Currency
    
    taxRate = GetTaxRate(salary)
    taxAmount = salary * taxRate
    takeHomePay = salary - taxAmount
'What is the intent here? Seems that you might have a Form?
'So we need LOTS more information from your form here
'not some other code that you copied from.
    'taxRateLabel.Invoke(Sub(x) taxRateLabel.Text = FormatPercent(x), taxRate)
    'taxAmountLabel.Invoke(Sub(x) taxAmountLabel.Text = FormatCurrency(x), taxAmount)
    'takeHomeLabel.Invoke(Sub(x) takeHomeLabel.Text = FormatCurrency(x), takeHomePay)
End Sub

Private Function GetTaxRate(ByVal salaryAmount As Currency) As Single
    Select Case salaryAmount
        Case Is > 1000000
            GetTaxRate = 0.4
        Case Is > 600000
            GetTaxRate = 0.25
        Case Else
            GetTaxRate = 0.15   'I don't know what rate less than 600000???
    End Select
End Function 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

So here's the code putting the results on Sheet1. Put the salary of interest in A2...

CODE

Sub testit()
    Dim salary As Currency
    
    salary = Sheet1.Cells(2, 1).Value
    CalculateDisplayAmounts salary
End Sub

Private Sub CalculateDisplayAmounts(ByVal salary As Currency)
    Dim taxRate As Single
    Dim taxAmount As Currency
    Dim takeHomePay As Currency
    
    taxRate = GetTaxRate(salary)
    taxAmount = salary * taxRate
    takeHomePay = salary - taxAmount
    
'that is the intent here? Seems that you might have a Form?
'So we need LOTS more information
    'taxRateLabel.Invoke(Sub(x) taxRateLabel.Text = FormatPercent(x), taxRate)
    'taxAmountLabel.Invoke(Sub(x) taxAmountLabel.Text = FormatCurrency(x), taxAmount)
    'takeHomeLabel.Invoke(Sub(x) takeHomeLabel.Text = FormatCurrency(x), takeHomePay)
    
'here's your values on Sheet1
    With Sheet1
        .Cells(1, 1).Value = "Salary"
        .Cells(1, 2).Value = "Tax Rate"
        .Cells(1, 3).Value = "Tax Amount"
        .Cells(1, 4).Value = "Take Home Pay"
        
        .Cells(2, 2).Value = taxRate
        .Cells(2, 3).Value = taxAmount
        .Cells(2, 4).Value = takeHomePay
    End With
End Sub

Private Function GetTaxRate(ByVal salaryAmount As Currency) As Single
    Select Case salaryAmount
        Case Is > 1000000
            GetTaxRate = 0.4
        Case Is > 600000
            GetTaxRate = 0.25
        Case Else
            GetTaxRate = 0.15   'I don't know what rate less than 600000???
    End Select
End Function 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: need to make a small project in vb for employee income and tax calculator

(OP)
Thank you for the help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close