Need slight modification on macro below

S

Sam Commar

I would really apprecaite any help on this.

I need to make a modification in the macro below

I now need to populate Destinateion Coloum F with value from Source Coloum F
when Value in Coloum C is 1.
If value is anythign else then the Source Value from Coloum F will go to
Coloum I:

Thanks so much

Sam Commar

Macro Below:

-----------------------------------------------


Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim cell As Range
Dim sh As Worksheet

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1

If Not IsError(Application.Match(.Cells(i, "C").Value, _
Array("8c", 8, "8b", "8d", 60, "7W", "7T"), 0)) Then
.Cells(i, "I").Value = .Cells(i, "F").Value
Else
.Cells(i, "I").Value = ""
End If
If Not IsError(Application.Match(.Cells(i, "C").Value, _
Array("8c", 8, "8b", "8d", 60, "7W", "7T"), 0)) Then
.Cells(i, "I").Value = .Cells(i, "C").Value
Else
.Cells(i, "I").Value = ""
End If
If .Cells(i, "C").Value = 2 Or _
.Cells(i, "C").Value = 3 Or _
.Cells(i, "C").Value = 4 Or _
.Cells(i, "C").Value = 10 Then
.Cells(i, "H").Value = .Cells(i, "D").Value
Else
.Cells(i, "H").Value = ""
End If
If .Cells(i, "C").Value = 2 Or _
.Cells(i, "C").Value = 3 Or _
.Cells(i, "C").Value = 4 Or _
.Cells(i, "C").Value = 10 Then
.Cells(i, "G").Value = .Cells(i, "C").Value
Else
.Cells(i, "G").Value = ""
End If
.Cells(i, "F").Value = ""
If .Cells(i, "C").Value = 5 Then
.Cells(i, "E").Value = .Cells(i, "D").Value
Else
.Cells(i, "E").Value = ""
End If
If .Cells(i, "C").Value <> 1 Then
.Cells(i, "D").Value = ""
End If
If .Cells(i, "B").Value < 51 Then
.Cells(i, "C").Value = Cells(i, "B").Value + 1000
Else
.Cells(i, "C").Value = Cells(i, "B").Value
End If
.Cells(i, "B").Value = "BATCH01"
.Cells(i, "A").Value = "EP7"

Next i

.Rows(1).Insert
.Range("A1").Value = "CO CODE"
.Range("B1").Value = "BATCH ID"
.Range("C1").Value = "FILE #"
.Range("D1").Value = "REG HOURS"
.Range("E1").Value = "O/T HOURS"
.Range("F1").Value = "REG EARNINGS"
.Range("G1").Value = "HOURS 3 CODE"
.Range("H1").Value = "HOURS 3 AMOUNT"
.Range("I1").Value = "EARNINGS 3 CODE"
.Range("J1").Value = "EARNING 3 AMOUNT"

End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top