Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Row must equal one of the following, or be deleted


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Row must equal one of the following, or be deleted

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I make cell "yes" equal 1, "no" equal 0 can I make cell yes equal 1, no equa Excel Discussion (Misc queries) 4 April 22nd 23 06:09 AM
i deleted info in excel then saved. can i recover deleted info? jbhtbruce Excel Discussion (Misc queries) 2 May 25th 10 08:54 AM
deleted text character returning numbers when deleted. Trreborr09 New Users to Excel 3 April 11th 10 03:17 AM
CountIF(A9:A20, B9 not equal B10, B10 not equal B11, etc.) Red Herald Excel Worksheet Functions 2 November 13th 08 12:11 AM
If No is deleted in middle of sequence,Nos alter after deleted No crusty53 New Users to Excel 3 June 20th 06 09:50 AM


All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"