Hello Everyone,
I am trying to build a code that will take all of the data that is labeled as "Paid" in the K Cell for that row, and take the specific Range of data and move that to another sheet, then clear the contents of specific cells on the original sheet. The problem is, when I run the code, nothing happens.
Here is where I am at:
Thank you in advance.
I am trying to build a code that will take all of the data that is labeled as "Paid" in the K Cell for that row, and take the specific Range of data and move that to another sheet, then clear the contents of specific cells on the original sheet. The problem is, when I run the code, nothing happens.
Here is where I am at:
Code:
Sub DataMove() Dim rg As Range
Dim xc As Range
Dim le As Long
Dim ni As Long
Dim ha As Long
le = Worksheets("Pending").UsedRange.Rows.Count
ni = Worksheets("Paid Off").UsedRange.Rows.Count
If ni = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Paid Off").UsedRange) = 0 Then ni = 0
End If
Set rg = Worksheets("Pending").Range("K1:K" & le)
On Error Resume Next
Application.ScreenUpdating = False
For ha = 1 To rg.Count
If CStr(rg(ha).Value) = "Paid" Then
rg(ha).Range("C:K").Copy Destination = Worksheets("Paid Off").Range("C" & ni + 1)
rg(ha).Range("C").ClearContents
rg(ha).Range("E").ClearContents
rg(ha).Range("H:J").Clear Contents
If CStr(rg(ni).Value) = "Paid" Then
h = h - 1
End If
n = n + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Thank you in advance.