So I have this code and it does not seem to be working and I have been slamming my head into a brick wall the past 2 days over it. The point of this macro is
1. find a row on 'Projects' and erase data in cells only. Based on a cell value.
2. find that same row in other sheets based on cell value & delete that row entirely
3. Copy the row to a sheet called 'tracking'
When I attempt to run this macro is says "We could do this for the selected range of cells. Select a single cell and try again" and highlights here
I have been trying to figure this out but I cannot seem to find the issue. It should be searching the usedrange? This is my first attempt to use auto-filter like this so it is probably any easy mistake... Any help would be greatly appreciated.
Sub Closeout(): Dim wt As Worksheet, wa As Worksheet, a As Long, t As Long
Dim wp As Worksheet, ws As Worksheet, N As String
Set wt = Sheets("Tracking"): Set wa = Sheets("Projects"): Set wp = Sheets("Pending")
t = Application.Max(3, wt.Range("A" & Rows.Count).End(xlUp).Row + 1)
For a = 5 To wa.UsedRange.Rows.Count
If wa.Range("R" & a) = "Move" Then
N = wa.Range("A" & a)
wt.Range("A" & t).Resize(1, 19).Value = wa.Range("A" & a).Resize(1, 19).Value
wa.Range("A" & a) = "": t = t + 1
Set ws = Sheets("Merchant 1"): GoSub Dumpem
Set ws = Sheets("Merchant 2"): GoSub Dumpem
Set ws = wp: GoSub Dumpem
End If
Next a
Exit Sub
Dumpem:
ws.UsedRange.AutoFilter Field:=1, Criteria1:=N
ws.UsedRange.Offset(2).SpecialCells(xlCellTypeVisible).EntireRow.Delete
ws.AutoFilterMode = False: Return
End Sub
Display More