Trying to run code on an Excel document that has compiled data. I am running two macros individually on each sheet. I am unable to run this macro on all the worksheets in this workbook. First macro is for sorting the columns:
Sub Macro1()
Dim ws As WorkSheet
Range("Sort").Select
Selection.Sort Key1:=ws.Range("q66"), Order1:=xlAscending, Key2:=ws.Range("u66") _
, Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Next WS
End Sub
Second macro is for hiding the rows based on value "Null":
Sub HideList()
Dim ws As Worksheet
Dim cell As Range
For Each cell In ws.Range("HideList")
With cell
.EntireRow.Hidden = _
(Value = "Empty")
End With
Next ws
End Sub
It works if I remove the ws
. from the range but again works only for single sheet.