Report

How to use AutoFilter Macro in Excel [Closed]

Ask a question WorldsOkayestExcelUser 3Posts Wednesday September 27, 2017Registration date September 28, 2017 Last seen - Last answered on Sep 28, 2017 at 04:17 PM by Ambucias
Complete Macro Newb, so I apologize for my ignorance. I know what the problem is, I am just not sure how to fix it.

I am filtering one spreadsheet (Utilization Report) by a specific Client, Copying all columns and pasting into another workbook (Book 1).
Each Client has its own tab by name in Book 1 and I will repeat the process 47 times until the specific clients are pulled out. The first client works as intended, but my problem is with "Active Window" (its not returning back to the Utilization Report for the filtered data.

I'm just not sure what specific parts of the code to change and how to identify the Utilization Report as the source for filtered data.


Sub CopyClientUtilInNetworkReports()
'
' CopyClientUtilInNetworkReports Macro
' Copy the CLIENT utilization reports to Book1 - run client in network setup first
'


'
Rows("1:1").Select
Selection.AutoFilter
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("B1").Select
ActiveSheet.Range("$A$1:$S$48588").AutoFilter Field:=2, Criteria1:= _
"Client 1"
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Windows("Book1").Activate
Sheets("Client 1").Select
Range("A1").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveSheet.Range("$A$1:$S$48588").AutoFilter Field:=2, Criteria1:= _
"Client 2"
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Windows("Book1").Activate
Sheets("Client 2").Select
Columns("A:A").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 1

Helpful
+0
plus moins
Greetings,

Please, bare in mind that CCM is a mutual aid community, all answers on the forum are provided by volunteers who give their time free to help solve issues.

Hence we request that CCM forum users show mutual respect. Therefore, when asking for assistance, please be courteous, as for elsewhere in similar circumstances in every day society when asking for help. (Usually, how would someone ask for help? i.e. please, thank you, appreciate, grateful, etc.)

Being courteous will increase your chances of getting the help you need.

http://ccm.net/contents/948-terms-of-use-for-ccm-respect-for-others

Please, copy, modify and repost your message respecting the politeness charter.

We trust that you understand.

Moderator

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!