Sheets("Plan1").Select
Range("D2").Select
Sheets("Plan1").Select
Range("D2").Select
Range(Selection, Selection.End(xlDown)).Select <-------- como faço pra ele usar o range de A em D2 em diante?
Selection.Copy
Sheets("Plan2").Select
ActiveSheet.Paste
Range("B1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=TRIM(RC[-1])"
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:B" & Sheets("Plan1").Range("A" & Rows.Count).End(xlUp).Row)
Range("B1:B" & Sheets("Plan1").Range("A" & Rows.Count).End(xlUp).Row).Select
Selection.Copy
Sheets("Plan1").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("Q2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Plan2").Select
Range("C1").Select
ActiveSheet.Paste
Range("D1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=TRIM(RC[-1])"
Range("D1").Select
Selection.AutoFill Destination:=Range("D1:D" & Sheets("Plan1").Range("A" & Rows.Count).End(xlUp).Row)
Range("D1:D" & Sheets("Plan1").Range("A" & Rows.Count).End(xlUp).Row).Select
Selection.Copy
Sheets("Plan1").Select
Range("Q2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Plan2").Select
Columns("A:D").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Plan1").Select
Range("A1").Select
End Sub
Esse é o código inteiro, acho que assim fica mais fácil.
Postado : 16/02/2018 7:27 am