Macro Help

C

cape

I am running the following macro and it will refresh the query but i
does not do the delete hidden rows. Help is always appreciated
Thanks


ActiveWorkbook.RefreshAll
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 60
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Calculate
Dim rDelete As Range
Dim rCell As Range
Dim wks As Worksheet

For Each wks In Worksheets
Set rDelete = Nothing
For Each rCell In wks.UsedRange.Columns(1).Cells
If rCell.EntireRow.Hidden Then
If rDelete Is Nothing Then
Set rDelete = rCell
Else
Set rDelete = Union(rDelete, rCell)
End If
End If
Next rCell
If Not rDelete Is Nothing Then rDelete.EntireRow.Delete
Next wks
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top