DeleteHiddenSourceColumnsFromTarget

DeleteHiddenSourceColumnsFromTarget

Public Sub DeleteHiddenSourceColumnsFromTarget( _
    rngSource As Range, _
    rngTarget As Range _
)
    Dim _
        rngColumn As Range, _
        intSourceColumnInitialOffset As Integer, _
        intSourceRowInitialOffset As Integer, _
        iColumn As Integer
    With rngSource.Cells(1, 1)
        intSourceColumnInitialOffset = .Column
        intSourceRowInitialOffset = .Row
    End With
    For iColumn = rngSource.Columns.Count To 1 Step -1
        If rngSource.Columns(iColumn).Hidden Then
            rngTarget.Columns(iColumn).Delete
        End If
    Next iColumn
End Sub

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *