I am trying to create a macro to look at payroll info and if the text in column A = Overtime then I want it to lookup(in another list) the word overtime and paste this in another sheet called (JNL) i have got it to work by typing in the code in the macro but i will have varioous codes for different names (see from below macro) not sure how to finish this off
Appreciate any help from you guys, i have gone as far as i can!
The macro must then run on every line
Sub Payroll()
Dim x As Variant
Dim i As Variant
For x = 10 To 15
i = Sheets("Data").Cells(x, 1)
If i = "Base salary" Then
Sheets("JNL").Cells(x, 14).Value = Sheets("Data").Cells(x, 3)
Sheets("JNL").Cells(x, 8).Value = "6111010"
ElseIf i = "Base salary for overtime" Then
Sheets("JNL").Cells(x, 14).Value = Sheets("Data").Cells(x, 3)
Sheets("JNL").Cells(x, 8).Value = "6111020"
Else
Cells(x, 5).Value = "Sorry No Account Info"
End If
Next x
End Sub
Appreciate any help from you guys, i have gone as far as i can!
The macro must then run on every line
Sub Payroll()
Dim x As Variant
Dim i As Variant
For x = 10 To 15
i = Sheets("Data").Cells(x, 1)
If i = "Base salary" Then
Sheets("JNL").Cells(x, 14).Value = Sheets("Data").Cells(x, 3)
Sheets("JNL").Cells(x, 8).Value = "6111010"
ElseIf i = "Base salary for overtime" Then
Sheets("JNL").Cells(x, 14).Value = Sheets("Data").Cells(x, 3)
Sheets("JNL").Cells(x, 8).Value = "6111020"
Else
Cells(x, 5).Value = "Sorry No Account Info"
End If
Next x
End Sub