OK. I will try to explain. Firstly please be aware that the symbol -> means to select the next command/option identified after the symbol (or additional option where more than one action is required on the same dialog)
For Each rngUniqVal In rngUnique This is the start of the loop through the Unique Numbers created in the worksheet "Unique List". The Unique numbers are created with previous code that copies the column from the source worksheet to the "Unique List" worksheet and then "Remove duplicates" is used to create the unique list. (This is the same as the "Remove duplicates" in the "Data" ribbon in the Interactive Mode).
wbMacro.Worksheets("Coversheet").Copy This is the same as the following procedure in the Interactive Mode (ie. working directly on the worksheet)
Right Click a worksheet tab name -> Move or Copy -> Check "Create a Copy" box -> In the "To book" field click the DropDown -> Select (new book). It creates a new (additional) workbook with a copy of the worksheet. The new Workook becomes the ActiveWorkbook by default.
Set wbOutput = ActiveWorkbook This assigns the new Workbook to a Workbook variable. As per the previous step, the New Workbook is the ActiveWorkbook. It does not matter what default name Excel assigned the New Workbook because it can now be referenced by the Workbook variable. (The new Worbook name will actually be Book1, Book2 etc and it will not clash with any other open Workbook but at this point the name is irrelevant).
For Each ws In wbMacro.Worksheets This loops through all of the Worksheets in the Macro workbook starting from the left tab. Now we don't want all of the Worksheets, only specific ones. eg Don't want "Coversheet" because it has already been copied to the new workbook and we don't want the "Unique List" Worksheet in the "Output" Workbook. therefore we use the following code to identify the required worksheets to be copied.
Select Case ws.Name
'Following line: If ws.Name matches any one of the names in the comma separated list then it is copied to the Output Workbook
Case "Output", "Sheet2 not required", "Static Sheet3", "Legend"
ws.Copy After:=wbOutput.Worksheets(wbOutput.Worksheets.Count)
End Select
ws.Copy After:=wbOutput.Worksheets(wbOutput.Worksheets.Count) This line in the above code positions the Copied Worksheet as the next tab after the Worksheets that have already been copied to the new Output Workbook
The "Select Case" code could be replaced with a number of If statements but I find it easier to use the Select Case where the required options can be all on one line separated by commas. If you need more information on the Select Case then I suggest that you Google it and I am sure you will find lots of informative data on it.
Set wbOutput = ActiveWorkbook
ActiveWorkbook would be MacroWorkbook right? How new workbook is created automatically. No! It is NOT the Macro Workbook. It is the new Output Workbook which becomes the ActiveWorkbook by default when it is created. See above for how the new workbook is created automatically when the worksheet is copied to a New Workbook.
myInp = rngUniqVal.Value
myInp is a range No! myInp is a String; not a range. rngUniqVal is a range of one cell that is created with the For Each rngUniqVal. myInp is the string value contained in rngUniqVal and is used to set the filter in the Table. rngUniqVal.Value references the value contained in the range rngUniqVal
lstObj.Range.AutoFilter Field:=1, Criteria1:=myInp This sets the filter to the string referenced by myInp.
strPathAndFileName = strPath & "" & strFileName & ".xlsx"
I don't see any save as method used here This purely creates a string of the Path and File Name to which the Output Workbook is saved. Up to this point the Output workbook has not been saved. The following code saves the Workbook as an xlsx workbook. I use SaveAs rather than Save because Save saves in the in the default file type as set in Options and its existing name which will be "Book#" at this point. SaveAs with the FileFormat overrides the user's default save type option. If you select File -> Options -> Save then the first option is used to determine the user's default file type for the first save of a file. After the first save of a file, any future saves default to the existing file type.
wbOutput.SaveAs Filename:=strPathAndFileName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Hope this explanation helps.