0% found this document useful (0 votes)
10 views3 pages

Resumocores ZSDvba

This macro copies data from one worksheet to another, applies filters and sorting to the data, and formats cells. It copies a range from the "Zsd_Formulas" sheet to the "Resumo p Fat" sheet. It then applies filters to the data based on certain criteria and sorts the data by multiple columns. It also fills down a formula, sets cell interior colors, and selects different cells and ranges.

Uploaded by

Gilliard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Resumocores ZSDvba

This macro copies data from one worksheet to another, applies filters and sorting to the data, and formats cells. It copies a range from the "Zsd_Formulas" sheet to the "Resumo p Fat" sheet. It then applies filters to the data based on certain criteria and sorts the data by multiple columns. It also fills down a formula, sets cell interior colors, and selects different cells and ranges.

Uploaded by

Gilliard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub ResumoCores()

'
' ResumoCores Macro
'

'
Sheets("Zsd_Formulas").Select
Columns("A:T").Select
Range("T1").Activate
Selection.Copy
Sheets("Resumo p Fat").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("1:1").Select
Application.CutCopyMode = False
Selection.AutoFilter
ActiveSheet.Range("$A$1:$Z$2064").AutoFilter Field:=20, Criteria1:= _
"Não fatura"
Columns("G:G").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("G1").Select
ActiveSheet.Range("$A$1:$Z$2064").AutoFilter Field:=20
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Add Key _
:=Range("E1:E2064"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Add Key _
:=Range("D1:D2064"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Add Key _
:=Range("T1:T2064"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-8],'Ovs. liberadas'!C[-11]:C[-10],2,FALSE)"
Range("L3").Select
ActiveWorkbook.RefreshAll
Range("L2:L7218").Select
Selection.FillDown
ActiveWindow.ScrollRow = 7152
ActiveWindow.ScrollRow = 7119
ActiveWindow.ScrollRow = 6720
ActiveWindow.ScrollRow = 5755
ActiveWindow.ScrollRow = 5555
ActiveWindow.ScrollRow = 4491
ActiveWindow.ScrollRow = 4158
ActiveWindow.ScrollRow = 3061
ActiveWindow.ScrollRow = 2595
ActiveWindow.ScrollRow = 1531
ActiveWindow.ScrollRow = 1131
ActiveWindow.ScrollRow = 732
ActiveWindow.ScrollRow = 267
ActiveWindow.ScrollRow = 167
ActiveWindow.ScrollRow = 1
Range("L1").Select
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=12, Criteria1:="Fatura"
Columns("A:T").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=12
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[7],'Ovs. liberadas'!C[-7]:C[-6],2,FALSE)"
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L7218")
Range("L2:L7218").Select
Range("A1").Select
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=1, Criteria1:= _
"=Canal OEM", Operator:=xlOr, Criteria2:="=Distrib./Revendedor"
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=8, Criteria1:="MI"
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=12, Criteria1:="Fatura"
Columns("A:T").Select
Range("T1").Activate
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Range("L1").Select
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=12
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=10, Criteria1:="0"
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=20, Criteria1:="Fatura"
Columns("A:T").Select
Range("T1").Activate
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$1:$Z$7218").AutoFilter Field:=20
Rows("1:1").Select
Selection.AutoFilter
Range("A1:T1").Select
Range("T1").Activate
Selection.AutoFilter
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Add Key _
:=Range("E1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort.SortFields.Add Key _
:=Range("D1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Resumo p Fat").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1:T1").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("I1").Select
End Sub

You might also like