excel vba - Sorting all worksheets in a workbook at once -


i have workbook 4 worksheets (sheet1, sheet2, ...). sheets same format; columns identical variables, have different values below. in theory, should able sorted in same way. i've tried ctrl-select tabs, sort option becomes unavailable @ point.

does know if there's way without making different macro each of 4 sheets? seems annoyingly redundant. appreciated.

i assume referring menu function sort. doesn't allow user select cells in different worksheets , sort them. implement each loop sort data in each worksheet within same macro. following

sub sortingallworksheet() dim wsh worksheet each wsh in thisworkbook.sheets     'sort columns c based on data in column c     wsh.columns("a:c").sort key1:=range("c2"), order1:=xlascending, header:=xlyes next end sub 

Comments