Caros,
Continuando na linha: "Revisitando As primeiras funções que desenvolvi".
DICA: Todas as funções que criarmos que tenham interação física direta nas planilhas que estivermos utilizando, terão uma performance muito melhor se colocarmos o comando Application.ScreenUpdating = False, antes do início do respectivo processamento.
Como deletar as linhas e colunas num range informado?
Sub DelEveryNthR (DeleteRange As Range, N As Integer)
Dim rCount As Long, r As Long
Application.ScreenUpdating = False
If DeleteRange Is Nothing Then Exit Sub
If DeleteRange.Areas.Count > 1 Then Exit Sub
If N < 2 Then Exit Sub
With DeleteRange
Let rCount = .Rows.Count
For r = N To rCount Step N - 1
.Rows(r).EntireRow.Delete
Next r
End With
End Sub
Sub DeleteEveryNthC (DeleteRange As Range, N As Integer)
Dim cCount As Long, c As Long
Application.ScreenUpdating = False
If DeleteRange Is Nothing Then Exit Sub
If DeleteRange.Areas.Count > 1 Then Exit Sub
If N < 2 Then Exit Sub
With DeleteRange
Let cCount = .Columns.Count
For c = N To cCount Step N - 1
.Columns(c).EntireColumn.Delete
Next c
End With
End Sub
Tags: Bernardes, MS, Microsoft, Office, Excel, deletar, apagar, excluir, row, lines, linha, range, rows, blank, removing, EntireRow, automatically, delete, column, coluna
Nenhum comentário:
Postar um comentário