DAGUET
Member
Dear VBA Matter Experts
I currently work on a database from which I need to export and filter some data and bring it to another worksheet.
I filter the data from a date (date being a date and not a string) which is located in K5 of my worksheet where I intend to bring the data. This date is named 'mois'.
When executing the macro he tells me the usual
'Application-defined or object-defined error'
and upon debugging it highlights this part of the code in yellow:
ActiveSheet.Range("$A$8:$AC$104").AutoFilter Field:=28, Operator:= _
xlFilterValues, Criteria:=Array(1, "mois")
Maybe I misspecified my variable but I cant really tell
Any help would be useful
Many thanks
My subroutine below
-----------------------------------------------------------------------------
Use << Code -tags >> please
I currently work on a database from which I need to export and filter some data and bring it to another worksheet.
I filter the data from a date (date being a date and not a string) which is located in K5 of my worksheet where I intend to bring the data. This date is named 'mois'.
When executing the macro he tells me the usual
'Application-defined or object-defined error'
and upon debugging it highlights this part of the code in yellow:
ActiveSheet.Range("$A$8:$AC$104").AutoFilter Field:=28, Operator:= _
xlFilterValues, Criteria:=Array(1, "mois")
Maybe I misspecified my variable but I cant really tell
Any help would be useful
Many thanks
My subroutine below
-----------------------------------------------------------------------------
Code:
Sub communication()
'
' communication Macro
'
Application.ScreenUpdating = False
'
Dim mois As Long
mois = ActiveSheet.Range("k5").Value
Sheets("diplomation").Select
ActiveSheet.Range("$A$8:$AC$104").AutoFilter Field:=28, Operator:= _
xlFilterValues, Criteria:=Array(1, "mois")
ActiveSheet.Range("$A$8:$AC$104").AutoFilter Field:=24, Criteria1:="="
Range("B8:H150,M8:M150").Select
Range("M8").Activate
Range("B8:H150,M8:M150,AB8:AB150").Select
Range("AB8").Activate
Selection.Copy
Sheets("network").Select
Range("A8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("diplomation").Select
Range("A8").Select
Selection.AutoFilter
Selection.AutoFilter
Sheets("Network").Select
Range("A1").Select
End Sub