Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danwagnerco/9df1976624e21c1ad8b01bdab05a3781 to your computer and use it in GitHub Desktop.
Save danwagnerco/9df1976624e21c1ad8b01bdab05a3781 to your computer and use it in GitHub Desktop.
Now that we have ClearAllFilters written, let's integrate it back into the original Subroutine!
'This subroutine creates adds the filtered data from Sheet1
'to a previously-existing destination Worksheet (called "Destination" here)
Public Sub AddToDestinationWorksheet(StartDate As String, EndDate As String)
'...
'Lots of code taken out here for brevity, the first place we're going to replace
'the old clear filters logic starts on line 38 of the original
'...
'Replaced the commented-out code with our new Subroutine, you should actually
'delete the commented out lines!
Call ClearAllFilters(wksData)
'wksData.AutoFilterMode = False
'If wksData.FilterMode = True Then
' wksData.ShowAllData
'End If
Exit Sub
'...
'Lots more code taken out for brevity, the next place we're going to replace
'the old clear filters logic starts on line 78 of the original
'...
'Replaced the commented-out code with our new Subroutine, you should actually
'delete the commented out lines!
Call ClearAllFilters(wksData)
'wksData.AutoFilterMode = False
'If wksData.FilterMode = True Then
' wksData.ShowAllData
'End If
'...
'The rest of the code wraps up and then we're done!
'...
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment