Hi all i have below list of 3 agents whose name and codes are given in column A , i made a macro on basis of code "FLEXMI" it will subtract fourth cell(column E) of FLEXMI with 8th cell of shift (column I).
step by step what code is doing
1. the code is matching 'FLEXMI' at 'A3'
2. then it does (I4 - E3)
3. then puts the result of the subtraction above as the new value of the cell 'I4'
PROBLEM is its only subtracting the first agent FLEXMI with his SHIFT TIME , rest two agents, its showing type mismatch error , because FLEXMI is given after SHIFT , or in the last , please correct my code ?????
code:
[p]Dim LR As Long, k As Long
LR = Cells(Rows.Count, 1).End(xlUp).Row
For k = 3 To LR
If Cells(k, 1).Value = "FLEXMI" Then
Cells(k, 1).Offset(1, 8).Value = Cells(k, 1).Offset(1, 8).Value - _
Cells(k, 1).Offset(, 4).Value
End If
Next k
[/p]
Bookmarks