Runtime Error 450; Why i cannot debug it? RRS feed

  • Question

  • Why whenever I record a macro and want to set a variable -- dialogue box will automatically say that wrong number of arguments or invalid property assignment. Can anybody help me? Because I am still new using VBA.

    Sub Advanced_Filter()
    ' Advanced_Filter Macro
    ' Keyboard Shortcut: Ctrl+Shift+A
        Set DataSH = Sheet1
            DataSH.Range("B8").CurrentRegion.Range.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
            "L8:L9"), CopyToRange:=Range("N8:T8"), Unique:=False
    End Sub
    Monday, October 8, 2018 3:35 AM

All replies

  • Remove the .Range between CurrentRegion and AdvancedFilter:

            DataSH.Range("B8").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
            "L8:L9"), CopyToRange:=Range("N8:O8"), Unique:=False

    And I would declare the variable DataSh at the beginning of the macro:

        Dim DataSH As Worksheet

    Regards, Hans Vogelaar (

    Monday, October 8, 2018 8:17 AM