Hi @averma
Filtering by loop is a valid method but it can be time consuming with larger data tables/lists since PAD runtime is not great (see, for instance, this thread). Don't know if that's your case.
@MichaelAnnis is right about VBA being more efficient for 'excel only' scenarios.
But if you need low-code and stick with PAD, an alternative approach is navigate through Excel commands using shortcuts.
This flow was tested and worked as intended:
1) 'Launch Excel' and open your master data workbook (%ExcelInstance1%)
2) 'Focus windows', Windows class = XLMAIN (in order to 'Send keys' actions work properly, the correct window must be focused)
3) 'Activate cell in Excel worksheet', row = 1 and column = number of column you want to filter
3) 'Send keys' {LShiftKey}({LControlKey}({L})). This sends Ctrl+Alt+L to Excel, which is the shortcut to apply filters (not necessary if you already have filter applied to data range)
4) 'Send keys' {Alt}({Down}). This sends Alt+Down to display filter drop down menu
5) 'Display input dialog' to capture ID you want to filter. It generates %UserInput% as variable
6) 'Send keys' {Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}%UserInput%{Return}. This fills the desired ID in Search field and filters the range
7) 'Send keys' {Control}({A}), to select all the filtered range (Ctrl+A shortcut)
😎'Send keys' {Control}({C}), to copy the selected range (Ctrl+C shortcut)
9) 'Read from Excel worksheet', row = 2, column = number of column that has the name you want to your 2nd Excel workbook. Rename output variable to %FileName%
10) 'Launch Excel' with a blank workbook (%ExcelInstance2%)
11) 'Paste cells to Excel worksheet' in ExcelInstance2, row = 1 and column = 1
12) 'Display select folder dialog' to select where to save the new workbook. This generates %SelectedFolder% as output variable
13) 'Save Excel' ExcelInstance2, save as document path = %SelectedFolder%\%FileName%