As stated in the Title, I am trying to first check the value in a particular cell, then if it matches, copy the entire row into a new sheet. No Errors are thrown but the result is empty. Please assist.
Public Function freshSheet(inPart As String)
Dim mag As Worksheet
Dim currRow As Long
Dim iohd As Worksheet
Dim magCount As Integer
Set iohd = ActiveWorkbook.Worksheets("IOHD")
'TODO: Create Magic Sheet.
Set mag = ActiveWorkbook.Worksheets.Add(After:=ActiveWorkbook.Worksheets(ActiveWorkbook.Worksheets.Count))
mag.Name = "Magic"
'TODO: Iterate through IOHD Sheet.
For currRow = iohd.Rows.Count To 2 Step -1
'TODO: IS PART EQUAL TO INPART? IF SO, COPY TO MAGIC SHEET
If iohd.Cells(currRow, 2).Value = inPart Then
magCount = mag.UsedRange.Rows.Count + 1
iohd.Cells(currRow, 2).EntireRow.Copy Destination:=mag.Cells(magCount, 1)
End If
Next
End Function