Notifications
Clear all
VBA & Macros
2
Posts
2
Users
0
Reactions
60
Views
Topic starter
I have difficulty doing:
1. If the user "Leave date" 13-Jul-22", "Payroll Status" is "Inactive".
The result in "Active" field is "No" and "custom_field: Last day of work" is 13/07/2022
2. If the user "Leave date" 31-Aug-22", "Payroll Status" is "Inactive".
The result in "Active" field is "Yes" and "custom_field: Last day of work" is 31/08/2022
Herewith I attach the latest file for your reference.
I'm stuck with this and need your guidance.
Posted : 27/08/2022 3:40 am
Hi Nabila,
1. If the user "Leave date" 13-Jul-22", "Payroll Status" is "Inactive".The result in "Active" field is "No" and "custom_field: Last day of work" is 13/07/20222. If the user "Leave date" 31-Aug-22", "Payroll Status" is "Inactive".The result in "Active" field is "Yes" and "custom_field: Last day of work" is 31/08/2022
For RangeToFilter, you have set an Autofilter:
.AutoFilter Field:=9, Criteria1:="=Active"
Therefore, these entries with Inactive will not show up in the filtered sheet. If you want them to show up in the filter sheet, don't filter them out.
This loop can be cleaned up, formatting should be done outside the loop:
For k = 2 To nwsLastRow
nws.Cells(k, 6) = IIF(nws.Cells(k, 6) = "Active", "Yes", "No")
If nws.Cells(k, 14) = "-" Then nws.Cells(k, 14) = ""
Next k
nws.Range(nws.Cells(2, 10), nws.Cells(nwsLastRow, 10)).NumberFormat = "dd/mm/yyyy"
nws.Range(nws.Cells(2, 14), nws.Cells(nwsLastRow, 14)).NumberFormat = "dd/mm/yyyy"
Posted : 02/09/2022 12:14 am