ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete rows that do not meet specific criteria (https://www.excelbanter.com/excel-programming/362858-delete-rows-do-not-meet-specific-criteria.html)

SITCFanTN

Delete rows that do not meet specific criteria
 
I download a report each day into excel that includes a weeks worth of data.
I only want to keep todays data for a specific transaction. The transactions
are in the A/C column and are A, B, C or D and I only want A's with for the
current date. My date is formatted as 60530 and is in the Entered column. I
now how to do this with a query in Access, my question is how and if I can do
this with VBA in an Excel Macro.
Thanks


Bearacade[_3_]

Delete rows that do not meet specific criteria
 

You can copy and paste after you filter using Autofilter.

Select the column. Go to _D_ata, _F_ilter, Auto_F_ilter. Select the
date you want.

Then go to _E_dit, _G_o To (or use Ctrl-G), click _S_pecial, select
Visible cells onl_y_.

Ctrl-C, go to another sheet and Ctrl V.


--
Bearacade
------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=546925


SITCFanTN

Delete rows that do not meet specific criteria
 
Is there a way this can be automated with VBA. I just want to keep rows with
A in the A/C column which is column C. When I did the autofilter, it changed
all rows in the spreadsheet to A which is not what I need. I want to delete
all rows that does not have an A in Column C of the Speadsheet. Thanks so
much. Oh I plan on putting this code in an existing macro titled PageSetup.

"Bearacade" wrote:


You can copy and paste after you filter using Autofilter.

Select the column. Go to _D_ata, _F_ilter, Auto_F_ilter. Select the
date you want.

Then go to _E_dit, _G_o To (or use Ctrl-G), click _S_pecial, select
Visible cells onl_y_.

Ctrl-C, go to another sheet and Ctrl V.


--
Bearacade
------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=546925



Bearacade[_6_]

Delete rows that do not meet specific criteria
 

Of course there is a way.

This is something I put together in a few minutes.. you have to change
it to fit your spreadsheet. I made it so that D5 is where you put the
AutoFilter terms.

Columns("A:A").Select
Selection.AutoFilter Field:=1, Criteria1:=Range("D5").Value
Cells.Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Application.CutCopyMode = False
Selection.AutoFilter
Range("A1").Select


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=546925



All times are GMT +1. The time now is 09:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com