php 过滤粘贴

It should have been a simple task in Excel VBA – copy a filtered range, and paste it into a new workbook. How many times have you written code to do that, and it always runs without problems?

在Excel VBA中,这应该是一个简单的任务–复制过滤的范围,然后将其粘贴到新的工作簿中。 您编写了几次代码来执行此操作,并且该代码始终可以正常运行?

However, last week a client sent me a file where that simple code wasn't working. While copying and pasting the filtered range, an error message kept popping up:

但是,上周一位客户给我发送了一个文件,该文件中的简单代码无法正常工作。 复制和粘贴过滤范围时,错误消息不断弹出:

Run-time error '1004': Paste method of Worksheet class failed.

运行时错误'1004':Worksheet类的粘贴方法失败。

寻找明显的问题 (Look For the Obvious Problems)

I figured there was some simple and obvious reason for the error, and went through the code, looking for problems.

我发现有一些简单明显的错误原因,然后遍历了代码,寻找问题。

I tweaked a few lines in the code, where there were ambiguous references, but nothing helped. That annoying error message kept popping up. And, ,to add to the confusion, the data had been copied onto the worksheet, despite the error message.

我在代码中调整了几行,其中有不明确的引用,但没有任何帮助。 该烦人的错误消息不断弹出。 而且,尽管有错误消息,但仍将数据复制到了工作表上,这增加了混乱。

A Google search was fruitless – there were many people complaining about similar problems, but no solutions that appeared to work. At least there weren't any solutions that I could find.

Google搜索是徒劳的-许多人抱怨类似的问题,但似乎没有解决方案。 至少没有我能找到的解决方案。

Most of the suggestions were to change the order of the steps, because Excel might be losing the copied data, before it could paste. I tried that too, and it didn't change anything.

大多数建议是更改步骤顺序,因为Excel在粘贴之前可能会丢失复制的数据。 我也尝试过,但没有任何改变。

过滤数据中的外部范围 (External Ranges in the Filtered Data)

Finally, I noticed that there were External Data ranges in the sheet where the filtered data was located. It seemed unlikely, but maybe those ranges were interfering with the copy and paste. So, I deleted those names, and tried the macro again. Amazingly, it worked!

最后,我注意到工作表中存在过滤数据所在的外部数据范围。 似乎不太可能,但是也许这些范围正在干扰复制和粘贴。 因此,我删除了这些名称,然后再次尝试了该宏。 令人惊讶的是,它有效!

I added code to delete those ranges as part of the macro, in case more External Data ranges are added to the data in the future.

我添加了将这些范围删除的代码作为宏的一部分,以防将来将来将更多外部数据范围添加到数据中。

删除命名外部范围的代码 (Code to Delete Named External Ranges)

In my client's workbook, all the external data range names started with "ExternalData_", so I used that to find the ranges and delete the names. Here is the bit of code that I added to the top of the macro.

在客户的工作簿中,所有外部数据范围名称均以“ ExternalData_”开头,因此我用它来查找范围并删除名称。 这是我添加到宏顶部的一些代码。

Dim nm As Name
For Each nm In ThisWorkbook.Names
If InStr(nm.Name, "ExternalData_") > 0 Then
nm.Delete
End If
Next nm

问题又回来了 (The Problem Comes Back)

Unfortunately, after running the revised macro for a while, the error message came back, even though the external data ranges had been deleted.

不幸的是,在运行修订的宏一段时间后,即使已删除外部数据范围,也会出现错误消息。

Maybe there were new ranges, that had different names, or perhaps deleting the external data ranges was just a temporary fix.

也许有新的范围,使用不同的名称,或者删除外部数据范围只是一个临时解决方案。

My client added an "On Error Resume Next" line to the macro, to get past the problem section, and that's working fine for now.

我的客户在宏中添加了“ On Error Resume Next”行,以跳过问题部分,目前为止工作正常。

As a better solution, I suggested using an Advanced Filter to extract the data to the new workbook, because is very fast (except in Excel 2007), and doesn't create the same error message.

作为更好的解决方案,我建议使用“ 高级筛选器”将数据提取到新工作簿中,因为它非常快(Excel 2007中除外),并且不会创建相同的错误消息。

You can record a macro as you manually run an Advanced filter and then tweak the code to make it flexible. See the steps and a video in this blog post: Advanced Filter Macro

您可以在手动运行“高级”过滤器时记录宏,然后调整代码以使其更灵活。 请参阅此博客文章中的步骤和视频: 高级筛选器宏

在Excel 2010中仍然是一个问题 (Still a Problem in Excel 2010)

The workbook that my client sent was created in Excel 2003, and that's were I did the testing, and found the solution.

我的客户发送的工作簿是在Excel 2003中创建的,那就是我进行了测试并找到了解决方案。

To see if the problem was fixed in newer versions of Excel, I tested the workbook in Excel 2007 and Excel 2010. If the External Data ranges were not deleted, the same error message appears when you run the copy and paste code.

若要查看问题是否在更高版本的Excel中得到解决,我在Excel 2007和Excel 2010中测试了工作簿。如果未删除“外部数据”范围,则在运行复制和粘贴代码时会出现相同的错误消息。

So, if you run into this error message, and none of the obvious solutions help, check for External Data, and delete those ranges, if possible. If you use this solution, please let me know if it works permanently, temporarily, or not at all.

因此,如果遇到此错误消息,并且没有明显的解决方案有帮助,请检查“外部数据”,并在可能的情况下删除这些范围。 如果您使用此解决方案,请让我知道它是否永久,暂时或完全不起作用。

翻译自: https://contexturesblog.com/archives/2012/10/18/error-1004-when-pasting-filtered-data/

php 过滤粘贴


http://www.taodudu.cc/news/show-3232581.html

相关文章:

  • VBA运行时错误1004错误
  • android播放器1004,Android音频开发MediaPlayer(-38,0)(-1004)错误解决
  • 在 Excel 中以编程方式复制工作表会导致运行时错误 1004
  • java重命名sheet失败_错误1004重命名工作表
  • VBA异常--运行时错误1004(将一个工作簿拆分多个工作表)
  • ISCSI概念、构架、连接方式、组成和工作原理
  • 5G基础课程 第2节 5G的关键技术
  • 北工大计算机网络95分复习——【第一章 引言】
  • 室内覆盖将成为5G连接无线和有线网络的关键
  • 欧盟调查显示100Mbps宽带网络建设需5020亿欧元资金
  • 使农村宽带民主化正在使它变得比原来更难
  • 【文献翻译】宽带水下换能器的等效电路
  • 4m宽带下载速度是多少_您真正的宽带速度是多少?
  • 载波聚合或双连接的方式进行_5G网络的关键技术有哪些
  • mysql和sql server连接不上_php-通过不可靠的网络连接在MySQL和SQL Server...
  • small cell 推动创新应用
  • 网络连接类型区分
  • C++ RasDial之调用RasEnumEntries遍历系统中存在的宽带连接名称
  • 百度android导航sd卡上,[转载]关于安卓4.4.2系统下,高德手机导航和百度手机导航离线地图在外置SD卡的...
  • 离线地图模式下实现路径规划
  • vue百度离线地图v3.0---区域划分
  • 百度离线地图示例之十三:动态运行轨迹实现(附源码)
  • (百度、高德、谷歌)离线地图二次开发
  • 百度地图3.0离线地图教程和echarts的结合使用
  • Bmap离线地图实现原理简介
  • leaflet离线地图(开发总结)
  • 如何下载百度离线地图瓦片数据
  • 离线地图开发瓦片数据详解
  • 百度地图离线_高德地图与百度地图有啥区别?功能只是其次,定位才是重点
  • LINUX系统下部署百度离线地图开发API

php 过滤粘贴_粘贴过滤的数据时出现错误1004相关推荐

  1. Kaggle上传数据时出现错误,且不是网络问题

    Kaggle上传数据时出现错误,且不是网络问题 Kaggle上传数据processing 数据时出现错误 Kaggle上传数据processing 数据时出现错误 Kaggle上传数据时,能够上传数据 ...

  2. java向数据库插入数据时的错误: Duplicate entry ‘‘ for key ‘PRIMARY‘ 问题解决

    java向数据库插入数据时的错误: Duplicate entry '' for key 'PRIMARY' 问题解决 参考文章: (1)java向数据库插入数据时的错误: Duplicate ent ...

  3. python协同过滤算法_协同过滤算法介绍及算法实现

    一.协同过滤算法简介 协同过滤算法是一种较为著名和常用的推荐算法,它基于对用户历史行为数据的挖掘发现用户的喜好偏向,并预测用户可能喜好的产品进行推荐.也就是常见的"猜你喜欢",和& ...

  4. MySQL导出数据反单引号_使用mysqldump导出数据时对字段中包含的单引号的处理

    最近在做一个日志统计项目,有一个辅助表是在MySQL数据库的,现在要将其迁移到Postgresql,自然是先用mysqldump将MySQL里面的数据导出,然后再导入到Postgresql即可.但在实 ...

  5. bartender外部表不是预期格式_批量合并Excel数据时“外部表不是预期格式”或“文件包含损坏数据”的两种情况...

    很多朋友在用Power Query合并(汇总)Excel数据时,碰到过"DataFormat.Error:外部表不是预期格式"或"DataFormat.Error:文件包 ...

  6. WCF传送大数据时的错误“ 超出最大字符串内容长度配额”

    格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出错: GetLzdtArticleResult.InnerException 消息是&qu ...

  7. apk部分手机安装失败_安装apk解析包时出现错误怎么办?小编快速帮你解决

    Android智能手机的用户都会或多或少的遇到到这样的问题--"安装apk解析包时出现错误".那么遇到这样的问题该如何解决?其实导致apk程序安装失败的原因是多方面的,而这所有的错 ...

  8. 用java下载apk解析包出错_安装apk解析包时出现错误怎么办

    安装apk解析包时出现错误怎么办 安装apk解析包时出现错误怎么办相信许多使用Android智能手机的用户都会或多或少的遇到到这样的问题--"解析包时出现错误".那么遇到这样的问题 ...

  9. python协同过滤算法_协同过滤(ALS)的原理及Python实现

    提到ALS相信大家应该都不会觉得陌生(不陌生你点进来干嘛[捂脸]),它是协同过滤的一种,并被集成到Spark的Mllib库中.本文就ALS的基本原理进行讲解,并手把手.肩并肩地带您实现这一算法. 完整 ...

最新文章

  1. [转]JSP常用指令
  2. RxJava从入门到不离不弃(四)——过滤操作符
  3. nodejs的web开发框架了解一下
  4. 卷积神经网络的网络结构——以LeNet-5为例
  5. 自制一个害羞的口罩,见人就闭嘴,戴着可以喝奶茶
  6. 2-SAT适定性(Satisfiability)问题知识点详解
  7. selenium自动化测试——常见的八种元素定位方法
  8. 如何判断一个new出来的空对象
  9. GYM 101617 F
  10. springboot 腾讯云短信平台SDK
  11. Ubuntu NumPy 安装
  12. kX3552 + HiFi级播放器 + wifi无线保真= 实战HiFi音乐娱乐欣赏
  13. CUDA学习(十一) 利用npp做图像处理
  14. Nebula Graph - SpringBoot 操作 Nebula
  15. python文件双击闪退_解决python文件双击运行秒退的问题
  16. 学习html的心得总结
  17. 计算机毕业设计Java网上租房管理(源码+系统+mysql数据库+Lw文档)
  18. gaussdb数据库 oracle,GaussDB OLTP 100 华为数据库的创建脚本和模板
  19. RC延时电路的 时间常数 和 延时时间(电压达到时间)和电容充放电时间计算和选取
  20. Meteorographica:一个用Python绘制天气图的气象代码库

热门文章

  1. 让你越来越富的5条赚钱建易,看懂的都说价值百万
  2. Linux下电骡aMule Kademlia网络构建分析I
  3. notion在WIN10设置中文
  4. 谷歌眼镜GDK开发指南之Immersions
  5. (附源码)node.js华联招聘网站011229
  6. JS初学小练(兔子繁殖问题)
  7. ISIJ 2018玛雅文字
  8. 洗地机最好的品牌有哪些、智能家居品牌排行
  9. 远山的呼唤 桥的在建
  10. 待办事项是什么意思,怎么用?