Estou com uma planilha com alguns botões de filtros.
A primeira etapa, filtra por fornecedor. A segunda, por mês e a terceira por semana.
Acontece que não estou conseguindo, depois de filtrar por fornecedor, filtrar em cima do primeiro filtro por mês e depois por semana.
Gente, estava mexendo aqui e fiz o seguinte macro para o botão de semana:
Sub FIRSTWEEK()
'
' FIRSTWEEK Macro
'
'
Dim koct As Boolean
Dim knov As Boolean
Dim kdec As Boolean
Dim kjan As Boolean
Dim kfeb As Boolean
Dim kmar As Boolean
Dim kapr As Boolean
Dim kmay As Boolean
Dim kjun As Boolean
Dim kjul As Boolean
Dim kaug As Boolean
Dim ksep As Boolean
If "OCT" = True And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
koct = True
End If
If "OCT" = False And "NOV" = True And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
knov = True
End If
If "OCT" = False And "NOV" = False And "DEC" = True And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kdec = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = True And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kjan = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = True And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kfeb = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = True And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kmar = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = True And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kapr = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = True And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = False Then
kmay = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = True And "JUL" = False And "AUG" = False And "SEP" = False Then
kjun = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = True And "JUL" = True And "AUG" = False And "SEP" = False Then
kjul = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = True And "JUL" = False And "AUG" = True And "SEP" = False Then
kaug = True
End If
If "OCT" = False And "NOV" = False And "DEC" = False And "JAN" = False And "FEB" = False And "MAR" = False And "APR" = False And "MAY" = False And "JUN" = False And "JUL" = False And "AUG" = False And "SEP" = True Then
ksep = True
End If
If koct = True Then
Sheets("DATABASE").Select
Range("AV3:AV60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If knov = True Then
Sheets("DATABASE").Select
Range("BA3:BA60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kdec = True Then
Sheets("DATABASE").Select
Range("BF3:BF60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kjan = True Then
Sheets("DATABASE").Select
Range("C3:C60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kfeb = True Then
Sheets("DATABASE").Select
Range("H3:H60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kmar = True Then
Sheets("DATABASE").Select
Range("M3:M60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kapr = True Then
Sheets("DATABASE").Select
Range("R3:R60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kmay = True Then
Sheets("DATABASE").Select
Range("W3:W60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kjun = True Then
Sheets("DATABASE").Select
Range("AB3:AB60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kjul = True Then
Sheets("DATABASE").Select
Range("AG3:AG60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If kaug = True Then
Sheets("DATABASE").Select
Range("AL3:AL60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
If ksep = True Then
Sheets("DATABASE").Select
Range("AQ3:AQ60").Select
Selection.Copy
Sheets("FILTER").Select
Range("E7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B15").Select
End If
End Sub
Só que dá um erro e não funciona... O que está errado? É mais ou menos isso mesmo para fazer o que quero?
Preciso de uma luz aqui.
Agora a planilha se encontra da maneira em anexo...
Agradeço antecipadamente,
Cristina.
"Only those who will risk going too far can possibly find out how far one can go."
Postado : 02/10/2013 10:51 am