Hi - i have data on sheet1 from A5 to O200. This data is divided at various points with subtotals. Right now i use 3 different versions of the same code to move a row to another sheet when Cloumn J = "Closed" the code for this is below. Is there a way to use only 1 code and move it to Sheet2 if Closed is found between rows 5 and 100, sheet3 for rows 101-150 and sheet4 for rows 151-200? thanks!
Code:
Dim sh1 As Worksheet, sh2 As WorksheetSet sh1 = Sheet1
Set sh2 = Sheet11
nextRow = sh2.Cells(sh2.Rows.Count, "A").End(xlUp).Row + 1
Dim rng As Range
Set rng = sh1.Range("B5:J100")
sh1.Range("B5:J100").AutoFilter 9, "Closed"
sh1.Range("B6:H100").SpecialCells(xlCellTypeVisible).Copy
sh2.Cells(nextRow, "A").PasteSpecial xlPasteValues
rng.SpecialCells(xlCellTypeVisible).ClearContents
sh1.AutoFilterMode = False