Hi all,
I have sheet1 where there is a data from column A to M.
Currently I have code which will select print area and send it for print.
I want to add one more aspect:
Sort the rows first based on cell values in column C grouping similar values rows together.
e.g. If cell values in column C are ... A1, B2, T3, Z4, X5, A1, B2, T3, Z4, X5
Then it will organise rows ..... A1,A1,B2,B2,T3,T3,Z4,Z4
Actual data in sample file is .........
A1 T2 F3 Y1 Y1print with sort.xlsm Z4 A1 T2 F3 Y1 Y1 Z4
I have attached sample file which has print code as follows:
Any help please.Sub setprintarea() Dim myrange As String myrange = Cells(Rows.Count, 13).End(xlUp).Address ActiveSheet.PageSetup.PrintArea = "$A$1:" & myrange End Sub Sub Meprint() Sheets("Sheet1").Unprotect "abcd" Columns("A:A").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="<>" ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Selection.AutoFilter Field:=1 Selection.AutoFilter Sheets("sheet1").Protect "abcd" End Sub
Kind regards
Bookmarks