in need of a macro for a complex task

Tonyk1051

Board Regular
Joined
Feb 1, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
Delete row 1 in sheet 1
Highlight column H and insert 2 new columns (do the same for sheet 2)
Highlight column X and insert 1 new column (do the same for sheet 2)

Highlight all of sheet 2 apply data filter

On column G
click select all, check boxes that have Manufacture, Working but missing parts,
tested confirmed defective, tested confirmed damage, picture of defect done

all the data that is found, cut and move to sheet 1

Now on sheet 1

highlight all of it and apply data filter
go to coulmn L and search for TT
all the data that it pulls delete entire row
now search for tv
all the data that it pulls delete entire row
unfilter sheet 1


instructions are always the same but data amount is always
different sometime less some times more, is this something a Macro can do?

1613264283654.png
 
Along with changing the And to Or as Mark said, you need to change the 2nd criteria to criteria2
VBA Code:
With WS1
        .Range("A1", .Range("AB" & .Rows.Count).End(xlUp)).AutoFilter Field:=12, Criteria1:="*TT*", Operator:=xlOr, Criteria2:="*tv*"
        .AutoFilter.Range.Offset(1).EntireRow.Delete
        .Range("A1").AutoFilter
    End With
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I only noticed as I couldn't understand why the TT were getting filtered.
With the xlAnd nothing should have been visible.
 
Upvote 0
I only noticed as I couldn't understand why the TT were getting filtered.
With the xlAnd nothing should have been visible.
I thought the same and got hung up on the case sensitivity when Autofilter isn't case sensitive :rolleyes: must be more tired than I thought.
 
Upvote 0
Don't miss my last post as we posted at roughly the same time ;)
AutoFilter Field:=12, Criteria1:="=*TT*", Operator:=xlOr, Criteria1:="=*TV*", i made the changes and it still didnt filter and delete shelves starting with TV....
 
Upvote 0
See post#11, you may have missed it.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
For the codes that says to insert 2 new columns in sheet 1, i copied and pasted a new line at the end as I needed to insert a new coulmn in coulmn W but got 2 new columns insteads.
Whats the code to just insert 1 new coulmn in WS1? thanks
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top