Hello all
I have this code which copies over values from the active worksheet to a sheet called "Actions" under the next available line if the value in "G" is equal to "A"
Can anyone help me please, I want to also only copy over only unique lines. (UID)
"B & E" together would be the UID but I am struggling to modify the code to include the UID
This is my exiting code
I have this code which copies over values from the active worksheet to a sheet called "Actions" under the next available line if the value in "G" is equal to "A"
Can anyone help me please, I want to also only copy over only unique lines. (UID)
"B & E" together would be the UID but I am struggling to modify the code to include the UID
This is my exiting code
Code:
Sub Copy()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim LR1 As Long
Dim LR2 As Long
Dim i As Long
Dim j As Long
Dim uid As String
Application.ScreenUpdating = False
Set sh1 = ActiveSheet 'original sheet
Set sh2 = Sheets("Actions") 'destination sheet
LR1 = sh1.Cells(Rows.Count, "B").End(xlUp).Row
LR2 = sh2.Cells(Rows.Count, "B").End(xlUp).Row
j = LR2
For i = LR1 To 2 Step -1
If sh1.Cells(i, 7) = "A" Then
j = j + 1
sh2.Range("B" & j).Value = sh1.Range("A" & i).Value
sh2.Range("C" & j).Value = sh1.Range("B" & i).Value
sh2.Range("D" & j).Value = sh1.Range("C" & i).Value
sh2.Range("E" & j).Value = sh1.Range("E" & i).Value
sh2.Range("F" & j).Value = sh1.Range("F" & i).Value
sh2.Range("G" & j).Value = sh1.Range("H" & i).Value
sh2.Range("I" & j).Value = sh1.Range("I" & i).Value
sh2.Range("I" & j).Value = Format(Date, "dd mmm yy")
End If
Next
Last edited: