在电子表格中,如何在其他列中删除条目? [英] In a spreadsheet, how do I delete entries from one column IF they appear in another?

查看:183
本文介绍了在电子表格中,如何在其他列中删除条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两列:列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.

任何帮助都将得到感激。

Any help will be met with gratitude.

推荐答案

使用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

''http://support.microsoft.com/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

这篇关于在电子表格中,如何在其他列中删除条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆