Tenho uma Dúvida simples:
Quero selecionar uma linha inteira onde encontra-se meu total geral e excluí-la independente do local onde esteja.
Sub Macro2()
'
' Macro2 Macro
'
' Atalho do teclado: Ctrl+i
'
'SELECIONA LINHA DE TOTAL E EXCLUI
Cells.Find(What:="total geral", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Selection.Delete Shift:=xlUp
'INÍCIO DA MACRO
Rows("5:5").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
Sheets("Meta x Real").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 127
ActiveWindow.ScrollRow = 123
ActiveWindow.ScrollRow = 121
ActiveWindow.ScrollRow = 118
ActiveWindow.ScrollRow = 104
ActiveWindow.ScrollRow = 84
ActiveWindow.ScrollRow = 26
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 1
Range("A21").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Meta x Real (2)").Select
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.End(xlDown).Select
'Rows("137:137").Select
'Selection.Font.Bold = True
'SELECIONA LINHA DE TOTAL
Cells.Find(What:="total geral", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
'INSERE BOLD NA LINHA INTEIRA
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
'INSERE LINHA INFERIOR E SUPERIOR NO TOTAL
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub
Postado : 16/09/2015 2:34 pm