I have never done VBA before, but found a code online to copy rows to a new sheet based on cell value. My problem is is that the source sheet is constantly being updated and every time I run teh macro it copies all teh rows all over again instead of just the newly inputted ones.
This is the code I am using. Is there any way to make it so it only transfers rows that are not already at the destination sheet?
Sub SHOESHOW()
'Updated by Extendoffice 2017/11/10
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("All Shipments").UsedRange.Rows.Count
J = Worksheets("Shoe Show").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Shoe Show").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("All Shipments").Range("F1:F" & I)
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) Like "*SHOE SHOW*" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Shoe Show").Range("A" & J + 1)
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Thanks!!
This is the code I am using. Is there any way to make it so it only transfers rows that are not already at the destination sheet?
Sub SHOESHOW()
'Updated by Extendoffice 2017/11/10
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("All Shipments").UsedRange.Rows.Count
J = Worksheets("Shoe Show").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Shoe Show").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("All Shipments").Range("F1:F" & I)
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) Like "*SHOE SHOW*" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Shoe Show").Range("A" & J + 1)
J = J + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Thanks!!