Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

.: Vitrine

Carregando artigos...

Views

Mostrando postagens com marcador empty. Mostrar todas as postagens
Mostrando postagens com marcador empty. Mostrar todas as postagens

Macro Excel - Deletando Linhas em branco - Delete Empty Rows

Inline image 1


Deletando linhas em branco...

Marque o bloco de linhas que deseja apagar

Sub Del_Empty_Rows()
Dim R As Long
Dim rng As Range
Application.ScreenUpdating = False
If Selection.Rows.Count > 1 Then
   Set rng = Selection
Else
   Set rng = ActiveSheet.UsedRange.Rows
End If
For R = rng.Rows.count To 1 Step -1
   If WorksheetFunction.CountA(rng.Rows(R).EntireRow) = 0 Then
      rng.Rows(R).EntireRow.Delete
   End If
Next R
Application.ScreenUpdating = True
End Sub


Tags: Macros, Excel, row, dell, delete, line, linha


VBA Excel - Excluindo Abas onde não tem qualquer conteúdo - Delete/Remove Blank/Empty Worksheets

Blog Office VBA | Blog Excel | Blog Access |
Inline image 1

Sub DeleteBlankSheets()
    Dim sh As Variant
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
On Error GoTo Exits:
    For Each sh In Sheets
'IsChart checks, if sh is a Chart Object or some other object.
        If Not IsChart(sh) Then

'CountA checks if there is any data in cells of the sheet
            If Application.WorksheetFunction.CountA(sh.Cells) = 0 Then sh.Delete
        End If
    Next sh
Exits:
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
End Sub

Function IsChart As Boolean
    Dim tmpChart As Chart
    On Error Resume Next
    Set tmpChart = Charts(sh.Name)
    IsChart = IIf(tmpChart Is Nothing, False, True)
End Function

Reference:
Tags: VBA, aba, worksheet, delete, excluindo, blank, empty, sheet



diHITT - Notícias