Yaron Yehezkel
New Member
- Joined
- Jul 11, 2020
- Messages
- 13
- Office Version
- 365
- Platform
- Windows
Hey guys,
I have some problem with my code and i hope to fine here the solution.
I have a data of employees and their monthly salary. At the end of each table, in each of the 5 specific sheets, is the "Monthly Salary in NIS" column.
I need that the total amount of all employees monthly salary (the sum) will be placed under the column "Monthly Salary in NIS" and one cell after the last data line.
The problem is that in each sheet, where the "Monthly..." columns is, there are different number of rows and columns (because not all the employees worked all those 5 months). so the thing is that i need that mt code will sum dynamically those columns (if i will add more rows, the calculation still will be placed one cell after the last data line in the specific columns) - at my code i set a particular cell, which is not my intention but i couldn't find the solution:
Thank you!
I have some problem with my code and i hope to fine here the solution.
I have a data of employees and their monthly salary. At the end of each table, in each of the 5 specific sheets, is the "Monthly Salary in NIS" column.
I need that the total amount of all employees monthly salary (the sum) will be placed under the column "Monthly Salary in NIS" and one cell after the last data line.
The problem is that in each sheet, where the "Monthly..." columns is, there are different number of rows and columns (because not all the employees worked all those 5 months). so the thing is that i need that mt code will sum dynamically those columns (if i will add more rows, the calculation still will be placed one cell after the last data line in the specific columns) - at my code i set a particular cell, which is not my intention but i couldn't find the solution:
VBA Code:
Sub SumIf()
ActiveCell.FormulaR1C1 = "=SUM([Monthly Salary in NIS])"
Range("F18").Select
Sheets("employees 1").Select
ActiveCell.FormulaR1C1 = "=SUM([Monthly Salary in NIS])"
Range("G20").Select
Sheets("employees 2").Select
ActiveCell.FormulaR1C1 = "=SUM([Monthly Salary in NIS])"
Range("H9").Select
Sheets("employees 3").Select
ActiveCell.FormulaR1C1 = "=SUM([Monthly Salary in NIS])"
Range("I40").Select
Sheets("employees 4").Select
ActiveCell.FormulaR1C1 = "=SUM([Monthly Salary in NIS])"
Range("J202").Select
Sheets("employees 5").Select
End Sub
Thank you!