tranzeodude
New Member
- Joined
- Jul 24, 2012
- Messages
- 5
My spreadsheet has 'Hours Worked' under column F and 'Pay Code' under column G.
What I want to do is whenever there are '601', '603', '17' under column G 'Pay Code', I want to cut/paste values from column F 'Hours Worked' to column K.
Below is my code which is partially working (it does moved based on the pay codes that I indicated but it is moving 'column G - Pay Code' instead of 'column F - hours worked' that I needed!):
Sub Macro1()
'
'
Dim rngA As Range
Dim rngB As Range
Dim cell As Range
Set rngA = Sheets("Employee Hours").Range("G2:G20")
Set rngB = Sheets("Employee Hours").Range("F2:F20")
For Each cell In rngA
If cell.Value = "601" Or cell.Value = "603" Or cell.Value = "17" Then
ActiveCell.Offset(0, 5).Range("A1").Select
Cells.Copy cell.Offset(0, 4)
Cells.Clear
End If
Next cell
'
End Sub
Please help.
What I want to do is whenever there are '601', '603', '17' under column G 'Pay Code', I want to cut/paste values from column F 'Hours Worked' to column K.
Below is my code which is partially working (it does moved based on the pay codes that I indicated but it is moving 'column G - Pay Code' instead of 'column F - hours worked' that I needed!):
Sub Macro1()
'
'
Dim rngA As Range
Dim rngB As Range
Dim cell As Range
Set rngA = Sheets("Employee Hours").Range("G2:G20")
Set rngB = Sheets("Employee Hours").Range("F2:F20")
For Each cell In rngA
If cell.Value = "601" Or cell.Value = "603" Or cell.Value = "17" Then
ActiveCell.Offset(0, 5).Range("A1").Select
Cells.Copy cell.Offset(0, 4)
Cells.Clear
End If
Next cell
'
End Sub
Please help.
Last edited: