Thread: Macro Help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cape cape is offline
external usenet poster
 
Posts: 1
Default Macro Help

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

--
Message posted from http://www.ExcelForum.com