Write a Macro, Q_6, that calculate employees\' New Salary 1 in column K using th
ID: 3806871 • Letter: W
Question
Write a Macro, Q_6, that calculate employees' New Salary 1 in column K using the logic: If an employee has been with the company less than 15 years, their salary remains the same, if they have been with company between 15 and less than 19 years, they get 6.25% increase- otherwise, they get 9.725% increase. Write a Macro, Q_7, that calculate employees' New Salary 2 in column L using the logic: If an employee is working in a department whose name starts with letter A or has been with the company more than 15 years, then her/his salary increases by 12%. If however, the employee is not () working in a department whose name starts with letter A, and has been with the company between 5 and 15 years, s/he gets a salary increase by 8.5%. In all other cases, salary remains the same. Write a Macro, Q_8, that will put the employee's month of birth in column "Birth Month", for each employee in the database. Month should be in text, e.g., March, May etc.Explanation / Answer
6)
Private Sub Q6()
Dim val As Integer
sal=Range("Salary")
val=DateDiff("yyyy", STARTDATE, Date())
If val < 15 Then
MsgBox "No icrement"
ElseIf val>15 AND val<=19 Then
Range("Salary")=sal*0.625+sal;
Else
Range("Salary")=sal*0.9725+sal;
End If
End Sub
7)
Private Sub Q7()
Dim LResult As Integer
Dim sal As Integer
sal=Range("Salary")
LResult = StrComp (left(originalString, 1), "A")
If val < 15 && LResult==0 Then
Range("Salary")=sal*1.2+sal;
Else
Range("Salary")=sal*0.85+sal;
End If
End Sub
8)
Private Sub Q8()
Dim m_val As Integer
Dim mon_val AS String
m_val=MONTH(BIRTH_DATE);
mon_val=MonthName(m_val);
Range("Birth_month")=mon_val;
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.