Hello,
I've seen some variations of this on the forum, but not really what I'm looking for. I have a list of users that's created through a Pivot Table, which I named "UserPivot." I also have a set of data on a worksheet. I want to check through that list of data and, if the username in column D doesn't appear in UserPivot, I want to delete the row of data. Here is what I have so far. I know my "If Not UserPivot..." line is not right, but I'm just not sure how to reference that little pivot table!
Dim r As Integer
Dim UserPivot As Object
For r = ThisWorkbook.Sheets("New Data Add").UsedRange.Rows.Count To 1 Step -1
If Not UserPivot.Exists(.Cells(r, "D").Value) Then
ThisWorkbook.Sheets("New Data Add").Rows(r).EntireRow.Delete
End If
Next
I've seen some variations of this on the forum, but not really what I'm looking for. I have a list of users that's created through a Pivot Table, which I named "UserPivot." I also have a set of data on a worksheet. I want to check through that list of data and, if the username in column D doesn't appear in UserPivot, I want to delete the row of data. Here is what I have so far. I know my "If Not UserPivot..." line is not right, but I'm just not sure how to reference that little pivot table!
Dim r As Integer
Dim UserPivot As Object
For r = ThisWorkbook.Sheets("New Data Add").UsedRange.Rows.Count To 1 Step -1
If Not UserPivot.Exists(.Cells(r, "D").Value) Then
ThisWorkbook.Sheets("New Data Add").Rows(r).EntireRow.Delete
End If
Next