本文介绍了VBA - 将可见列单元格复制到另一个工作表 - 数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



嗨朋友,



我只想复制来自 的可见细胞工作表  1 到工作表2  -  使用数组,
$


我被困在特殊的可见单元格上。


我已经包含了伪代码以下,因为我不确定正确的使用方法








hi friends,

I wanted to only copy the visible cells from  worksheet  1  to Worksheet 2  -   using an array,

I am stuck on the special visible cells

I have included the pseudo code below, as im not sure the correct approach to use



Sub Copy_Paste_Special_Cells() 'pseudocode Dim oSourceWksht As Worksheet Dim oDestinationWksht As Worksheet Dim i As Long Set oSourceWksht = ThisWorkbook.Worksheets("Sheet1") Set oDestinationWksht = ThisWorkbook.Worksheets("Sheet2") 'from stack exchange '---------------- 'Special visible cells

设置r = r.SpecialCells(xlCellTypeVisible)
对于每个rC在r
j = j + 1
如果j = 10或j = r。计数然后退出
下一个rC
范围(r(1),rC).SpecialCells(x lCellTypeVisible)。复制
'--------------


oCopyRange = Array("A列 - 可见单元格"," B列可见单元格")

oDestinationRange = Array(" A1"," A50")



i = LBound(oCopyRange) )到UBound(oCopyRange)

oSourceWksht.Range(oCopyRange(i))。复制目的地:= oDestinationWksht.Range(oDestinationRange(i))

下一个

End Sub

Set r = r.SpecialCells(xlCellTypeVisible) For Each rC In r j = j + 1 If j = 10 Or j = r.Count Then Exit For Next rC Range(r(1), rC).SpecialCells(xlCellTypeVisible).Copy '-------------- oCopyRange = Array("Column A - Visible Cells", "Column B Visible Cells") oDestinationRange = Array("A1", "A50") For i = LBound(oCopyRange) To UBound(oCopyRange) oSourceWksht.Range(oCopyRange(i)).Copy Destination:=oDestinationWksht.Range(oDestinationRange(i)) Next End Sub







谢谢你的帮助





干杯丹:)




thank you for your help


Cheers Dan :)

推荐答案


这篇关于VBA - 将可见列单元格复制到另一个工作表 - 数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 06:03