all the inserts and columns are always the same but once it gets to the filter part, the amount of data it pulls will always be different, next week there could a 3000 more lines or 3000 less
is there away to modify this code so that it can work with any amount of data? like i said steps are always the same search criteria is always the same
is there away to modify this code so that it can work with any amount of data? like i said steps are always the same search criteria is always the same
VBA Code:
Sub Macro1()
'
' Macro1 Macro
' step 1
'
'
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("H:H").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveWindow.LargeScroll ToRight:=2
ActiveWindow.SmallScroll ToRight:=-1
Columns("W:W").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("On a Category").Select
Columns("H:H").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveWindow.LargeScroll ToRight:=2
Columns("W:W").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveWindow.ScrollColumn = 1
Cells.Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AK$26589").AutoFilter Field:=7, Criteria1:=Array( _ (i always uncheck the boxes and check the same 5, what ever is pulled is moved to sheet 1)
"MANUFACTURE", "PICTURE OF DEFECT DONE", "TESTED CONFIRMED DAMAGED", _
"TESTED CONFIRMED DEFECTIVE", "WORKING BUT MISSING PARTS"), Operator:= _
xlFilterValues
Rows("122:122").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
Sheets("Not on a Category").Select
ActiveWindow.ScrollRow = 11655
ActiveWindow.ScrollColumn = 1
Range("A11678").Select
ActiveSheet.Paste
ActiveWindow.ScrollRow = 1
Cells.Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AK$38140").AutoFilter Field:=12, Criteria1:=Array( _ (in the filter box, i search for anything that has tt and tv and delete what ever it pulls)
"TT-01-DC", "TT-03-A", "TT-03-DC", "TT-04-A", "TT-08-A", "TT-21-DD", "TT-23-A", _
"TT-24-A", "TT-24-B", "TT-24-DA", "TT-24-F", "TT-25-A", "TT-30-A", "TT-31-A", _
"TT-32-A", "TT-33-A", "TT-34-A", "TT-35-A", "TT-38-A", "TT-40-A", "TT-41-A", "TT-42-A" _
, "TT-43-A", "TT-45-A", "TT-46-A", "TT-47-A", "TT-48-A", "TT-49-A", "TT-50-A", _
"TT-52-A", "TT-53-A", "TT-55-A"), Operator:=xlFilterValues
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$1:$AK$36959").AutoFilter Field:=12, Criteria1:= _
"TV-01-A"
Rows("1665:1665").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Cells.Select
Selection.AutoFilter
End Sub
Last edited by a moderator: