文章预览
学习Excel技术,关注微信公众号: excelperfect 标签: VBA , 自定义函数 下面的自定义函数来源于 mrexcel.com 。其作用是,复制粘贴可见单元格,具体地说,确保如果复制的源单元格区域与粘贴区域有重叠时,不会覆盖掉源区域中的重叠区域;如果源区域与目标区域相同,则不会复制粘贴任何内容。 详细代码如下: ' 将可见单元格从一个区域复制到另一个区域中的可见单元格. Function VisibleToVisible() As Boolean Const cstrTitle As String = "Visible To Visible" Const clngFirst As Long = 1 Const clngRange As Long = 8 Const clngRow As Long = 1 Const clngCol As Long = 2 ' Dim strErrMsg As String ' Dim bolAlerts As Boolean Dim bolEvents As Boolean Dim bolStatus As Boolean Dim bolScreen As Boolean Dim xlcCalc As XlCalculation ' Dim rngSrcCell As Range Dim rngSrc As Range Dim rngDst As Range Dim lngSrcRow As Long Dim lngSrcCol As Long
………………………………