Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have an worksheet with over a 2,000 records, which I append to a tabl through ADO. In order to limit the number of records appended to th table, I would like to delete the rows that column K does not equal on of the following (such as apples, bananas, oranges, mangos, etc) First, I need to know how to write this statement AND if it should be in a seperate loop than the ADO recordset appending statement. Thanks.. -- samjayne ----------------------------------------------------------------------- samjaynes's Profile: http://www.excelforum.com/member.php...fo&userid=1627 View this thread: http://www.excelforum.com/showthread.php?threadid=27682 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
samjaynes wrote in ...
I have an worksheet with over a 2,000 records, which I append to a table through ADO. In order to limit the number of records appended to the table, I would like to delete the rows that column K does not equal one of the following (such as apples, bananas, oranges, mangos, etc) First, I need to know how to write this statement AND if it should be a in a seperate loop than the ADO recordset appending statement. If this was .Excel.Misc, I'd say use autofilter to show just the unwanted rows and delete them manually. Because this is .Excel.Programming I'll say, why delete the unwanted rows? You could simply disregard them during processing and delete *all* rows when you are done. How are you currently adding the rows to the recordset? If you are looping through your worksheet row by row, this would be a good point to test for unwanted rows. For a more detailed answer, post your existing code. FWIW if your database is another Jet datasource (mdb, xls, csv, txt, etc) then you should be able to do this in one hit (without the recordset) using a JOIN e.g. (aircode) INSERT INTO [MS Access;Database=C:\MyJetDB.mdb;].MyTable (MyKeyCol, MyDataCol) SELECT F1 AS MyKeyCol, F2 AS MyDataCol FROM [Excel 8.0;HDR=No;Database=C:\MyWorkbook.xls;].[Sheet1$J:K] WHERE F2 NOT IN ('apples', 'bananas', 'oranges', 'mangos') ; Jamie. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can I make cell "yes" equal 1, "no" equal 0 | Excel Discussion (Misc queries) | |||
i deleted info in excel then saved. can i recover deleted info? | Excel Discussion (Misc queries) | |||
deleted text character returning numbers when deleted. | New Users to Excel | |||
CountIF(A9:A20, B9 not equal B10, B10 not equal B11, etc.) | Excel Worksheet Functions | |||
If No is deleted in middle of sequence,Nos alter after deleted No | New Users to Excel |