如何在导入访问表之前删除excel文件的特定行? [英] How to delete particular row of an excel file before importing into an access table?

查看:80
本文介绍了如何在导入访问表之前删除excel文件的特定行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一堆excel文件存储在一个文件夹中,并且有一个代码可以通过打开一个对话框来选择合适的Excel工作表。但是,每个excel表格都有一行,其中包含Total字样。在一个或多个列中。我不想在我的访问表中看到包含单词total的行,所以我希望在将excel表转移到访问权限之前将其删除。


感谢你的帮助。

Hi guys,
I have a bunch of excel files stored in a folder and have a code to choose the appropriate excel sheet by opening up a dialog box. However, each excel sheet has a row which include the word "Total" in one or more columns.I dont want to see that row containing the word total in my access table so I want it to be deleted before the excel sheet is transferred into access.

Thanks for your help in advance.

推荐答案

  1. 如果在Excel文件的上下文中完成,这是一件简单的事情,涉及:
  1. This is a simple matter if done within the context of the Excel Files, and involves:
  1. 定义范围对象。
  2. 循环遍历Range中的每个Cell以查看它是否包含String Total。
  3. 删除包含该值的相应Row。

  • 相同进程可以在Access中完成,但会更复杂,并且涉及在实际导入之前执行此操作的自动化代码。
  • 代码发布如下:

  • The same process can be accomplished in Access, but would be more complex and involve Automation Code that performs this operation prior to the actual Import.
  • The Code is posted below:

    展开 < span class =codeDivider> | 选择 | Wrap | 行号


    感谢ADezii,实际上我应该更好地表达我的问题。我想要的是没有导入访问权限的行的行我不希望从我的Excel文件中永久删除它。所以也许有一种方法可以终止我的TransferSpreadsheet方法并在它看到那行时退出sub?

    感谢您的回复。
    Thanks ADezii, actually I should have phrased my question a little better. What I want is the row with the word Total to not get imported into access I dont want to have it deleted like permanently from my excel files. So maybe have a way of terminating my TransferSpreadsheet method and exiting the sub when it sees that row??
    Thanks for the reply.


    别想使用TransferSpreadsheet()方法有任何方法可以做到这一点。为什么不在导入后删除表中的行?
    Don''t think that there is any way of doing this using the TransferSpreadsheet() Method. Why not DELETE the Rows in the Table after Import?


    这篇关于如何在导入访问表之前删除excel文件的特定行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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