Notifications
Clear all

Otimizar código

5 Posts
3 Usuários
0 Reactions
1,061 Visualizações
(@dimorais)
Posts: 431
Reputable Member
Topic starter
 

Boa tarde
Esse deleta bordas, formatos, cores etc e tal. Precisava deixar mais compacto e "limpo", coisa de profissional. Ajuda Aew :D

Sub DelG()
Application.ScreenUpdating = False
    Range("DB39:DV41 ").Select
Selection.ClearContents
Selection.FormatConditions.Delete
Selection.Borders.LineStyle = xlNone
    With Selection.Interior
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("W38").Select
Application.ScreenUpdating = True
End Sub
 
Postado : 31/03/2016 1:21 pm
(@leonardo)
Posts: 81
Trusted Member
 

Olá dimorais,

Veja se ficaram mais limpas as linhas abaixo?

Sub DelG()

Application.ScreenUpdating = False

With Range("DB39:DV41")
    .ClearContents
    .FormatConditions.Delete
    .Borders.LineStyle = xlNone
    With .Interior
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight1
    End With
End With
Range("W38").Select
Application.ScreenUpdating = True

End Sub
 
Postado : 31/03/2016 1:44 pm
(@dimorais)
Posts: 431
Reputable Member
Topic starter
 

Xii, deu erro nas alterações. :roll: :roll:

 
Postado : 31/03/2016 2:31 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa noite,

Veja se atende:

Sub Limpar()
    [DB39:DV41].Clear
    [DB39:DV41].Interior.ThemeColor = xlThemeColorLight1
    [W38].Select
End Sub

Abraço

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 31/03/2016 5:35 pm
(@dimorais)
Posts: 431
Reputable Member
Topic starter
 

Duas linhas e grato. :lol:

 
Postado : 01/04/2016 7:29 am