在Excel中复制粘贴后未隐藏隐藏的行 [英] Hidden rows not hidden after copy paste in excel

查看:99
本文介绍了在Excel中复制粘贴后未隐藏隐藏的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将excel工作簿的内容复制到另一个工作簿.我的工作表中有很少的隐藏行,这些行也必须保持隐藏在目标工作簿中.我正在使用以下代码行复制数据:

I am copying contents of an excel workbook to another workbook.My sheet has few hidden rows which has to be kept hidden in the target workbook as well. I am using the below lines of code to copy the data :

'Set rngCopyRange = wbSource.ActiveSheet.Cells
rngCopyRange.Copy

在Win 10 64位,Office 2013 64位或Office 2016 32位组合中工作正常但是在Windows 10 64b,Office 2010 32b或2013 32b组合中,隐藏的行不是隐藏的.这是excel版本的问题吗?有人可以帮我解决这个问题吗?

This works fine in Win 10 64 bit,Office 2013 64bit or Office 2016 32 bit combination But in windows 10 64b , Office 2010 32b or 2013 32b combination,the hidden rows are not hidden. Is this an issue with excel version?Can someboby help me to sort this issue?

推荐答案

多么奇怪.我使用的是2013(64位),如果使用您的代码,我不会跨每一行的隐藏属性复制到目标.

How odd. I'm using 2013(64bit) and if I use your code I DO NOT copy across the hidden property of each row to the target.

我认为您遇到的问题是,您要复制的范围并不覆盖所有列,因此设置行高(即所有列)将违反直觉.

I think the issue you're getting though is that you're copying across a range that doesn't extend across all columns, so setting the row height (i.e. for all columns) would be counter-intuitive.

如果将 .EntireRow 添加到您的复制范围,则将遇到行高:

If you add .EntireRow to your copy range, the row height will come across:

Set rngCopyRange = wbSource.ActiveSheet.UsedRange.EntireRow

这篇关于在Excel中复制粘贴后未隐藏隐藏的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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