Delete Rows that Don't Match Criteria
I have seen similar questions posed but usually it is delete a row if it equals a certain criteria. I want to do the opposite, delete it if it doesn't match.
Deleting the row is only part of a macro. Basically copying some data from one tab and pasting on a second tab and then deleting unneeded rows on the second tab so I always have original.
So the data list starts in row 6 with headers in row 5 and some report titles and such above that. The cell I need to match to is cell A3. In the data table the column I am looking for the match is in "U".
I am no expert by any means at VBA but here is what I have pieced together so far.
Dim nr As Long, i As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
nr = Range("U6").SpecialCells(xlLastCell).Row
For i = nr To 1 Step -1
If .Value <> A3 Then
Application.EnableEvents = True
Application.ScreenUpdating = True
When I run it though it deletes everything up to and including my header in row 5 and I know there are matches in column U to what is in cell A3.
Any help would be greatly appreciated.
Keys to the Problem Delete Rows that Don't Match Criteria
UPDATE: Oddly when I do the U8=A3 I get false.
If you're getting FALSE then the values aren't the same, try this on that cell
This returns a number and they should boyh be the same, if they aren't then one cell has more characters than the other and you nee to establish what that is and then someone will tune the macro to cope with that.
It most likely the first or last character of the longer cell so try this on A3 and U8 and let us know what it returns
OOPS, Just noticed, the correct syntax is this, note the square brackets
If .Value <> [A3] Then
To install drivers and other optional updates
- To install optional updates, you need to review and then select them from the list of updates that Windows finds for your computer. Optional updates are not installed automatically.
- Open Windows Update by clicking the Start button Picture of the Start button, clicking All Programs, and then clicking Windows Update.
- In the left pane, click Check for updates, and then wait while Windows looks for the latest updates for your computer.
- If any updates are found, click View available updates.
- Select the optional updates that you want, and then click Install. Administrator permission required If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
Another Safe way to Fix the Problem: Delete Rows that Don't Match Criteria:
How to Fix Delete Rows that Don't Match Criteria with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your computer. Open it, and it will scan your system. The junk files will be shown in the scan result.
2. After the scan is finished, you can see the errors and problems which need to be repaired.
3. The Repair part is done, the speed of your computer will be much higher than before and the errors have been fixed. You can also use other functions in SmartPCFixer. Like dll downloading, junk file cleaning and print spooler error repair.
Related: How to Update & Download NVidia GeForce 6100/nForce 420 WHQL Certified driver v.178.13,How to Update & Download NVidia GeForce 7600 GS Video Driver v.295.75 Certified,How Can I Update & Download NVidia GeForce 820M Driver v.344.48 WHQL,[Solved] Download NVidia GeForce GTX 560M VGA Driver v.296.17 Certified,Way to Update & Herunterladen NVidia GeForce GT 130M Video Treiber v.295.75 Certified,How to Update & Download SONY SVE14A1X1RH Realtek Ethernet Driver,Where to Download SONY SVS13A2W9ES Bluetooth Driver (Intel) v.2.6 - 184.108.40.206059,Best Way to Update & Download SONY VGN-CR203E Conexant HDAUDIO SoftV92 Data Fax Modem with SmartCP Setup Program v.220.127.116.11 driver,Best Way to Download SONY VGN-FE790G/N Wireless LAN Driver v.10.6.0.29,Method to Update & Download SONY VGN-NR31Z/S Firmware Extension Parser Device v.18.104.22.168,How to Fix Error 0x0000c1f5 Solución?,Error 0x80071a91 Win7 Fix Patch,Error 0x800ccc60 Windows Live Mail [Solved],Error Message 0x800ccc79 Outlook 2000 Fix,What is Error 0xc1ab0001?,[Answered] x64 saplugin dll,How to Fix Problem - Kb943729 Download?,Troubleshooting: Bccode D1 Error,Java Runtime Tech Support,Troubleshooting: ERROR NO SUCH GROUP Error
Read More: [Solved] Default address locations on envelopes,How Can I Fix - debut video capture program (also tried three other capture programs) not recognising usb 2 video capture sound?,Fast Solution to Error: DE-DUPING ROWS AGAINST CRITERIA IN MORE THAN 1 COLUMN,How to Resolve - DELL laptop, gadget will NOT work on Windows 7, never worked?,Fast Solution to Error: Defrag deletes system restore points