如果条目出现在另一列中,如何删除它们?

编程入门 行业动态 更新时间:2024-10-27 02:22:00
本文介绍了如果条目出现在另一列中,如何删除它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

两列:A列包含可用期刊标题的完整列表; B列包含我的图书馆已预订的那些条目。

Two columns: Column A contains a complete list of available journal titles; Column B contains the ones to which my library already subscribes.

如果它们也出现在B列中,是否可以从A列中删除条目?

Is it possible to delete entries from Column A if they also appear in Column B?

换句话说,我想燕尾两列,以便两列都没有条目。

In other words, I want to 'dovetail' two columns so that no entry is represented in both columns.

推荐答案

您可以将ADO用于数据库类型的操作,例如:

You can use ADO for database-type actions, for example:

Dim cn As Object Dim rs As Object Dim strFile As String Dim strCon As String Dim strSQL As String Dim i As Integer ''support.microsoft/kb/246335 strFile = ActiveWorkbook.FullName ''Note HDR=No, so F1,F2 etc is used for column names ''If HDR=Yes, the names in the first row of the range ''can be used. strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile _ & ";Extended Properties=""Excel 8.0;HDR=No;IMEX=1"";" Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") cn.Open strCon strSQL = "SELECT F1 FROM [Sheet9$] WHERE F2 Is Null OR UCase(F2)<>UCase(F1)" rs.Open strSQL, cn, 3, 3 Worksheets("Sheet10").Cells(2, 1).CopyFromRecordset rs

更多推荐

如果条目出现在另一列中,如何删除它们?

本文发布于:2023-10-30 08:11:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542275.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出现在   条目

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!