Eu tenho a macro a seguir e quero reduzir o número de linhas para acelerar o processo.
5
ActiveCell.Columns("A:A").EntireColumn.Select
If Selection.Find(What:="*", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True) Is Nothing Then
GoTo 6
End If
Selection.Find(What:="*", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=True).Activate
ActiveCell.Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
GoTo 5
Eu quero substituir vários "Selection.Insert Shift: = xlToRight" linhas com uma única linha usando Offset.
Você pode por favor ajudar!
Respostas:
1 para resposta № 1Substitua seu x5 Selection.Insert Shift:=xlToRight
de Range(ActiveCell, ActiveCell.Offset(0, 4)).Insert shift:=xlToRight
EDITAR
Mais relacionado ao seu código: Range(Selection, Selection.Offset(0, 4)).Insert shift:=xlToRight