We help IT Professionals succeed at work.

Unhide Rows

Cartillo
Cartillo asked
on
Hi Experts,

I would like to request Experts help. The attached script has been used to Hide and Unhide rows at Week1 to Week5 Sheets. The macro should be able to display all time value at Column A (00:00 to 23:55) if click the "Unhide" sub,  however few rows especially after 23:00 are still hidden. Hope Experts would help to fix this problem. Attached the workbook for Experts perusal.
Unhide-Rows.xls
Comment
Watch Question

I would suggest you to change the code of Unhide as follows. It will unhide all the rows of worksheets. No need to loop through all the rows :

Sub UnhideRows()

Dim ws As Worksheet
Dim I As Long

    For I = 1 To 5
        Set ws = Worksheets("Week" & I)
        ws.Rows.Hidden = False
    Next I
End Sub

Author

Commented:
Hi VipulKadia,

Need you help. Is that possible to delete all data at  Range("B4:H291") and color fill?  At the same time Wrap text and Center text. Hope you will consider this request.
Modify your sub routine as follows :
Sub UnhideRows()

Dim ws As Worksheet
Dim I As Long
Dim rng As Range

    For I = 1 To 5
        Set ws = Worksheets("Week" & I)
        ws.Rows.Hidden = False
       
        Set rng = ws.Range(ws.Cells(4, 2), ws.Cells(291, 8))
        rng.Cells.ClearContents
        rng.Cells.Interior.ColorIndex = 2
        rng.Cells.WrapText = False
        rng.Cells.HorizontalAlignment = xlHAlignGeneral
        rng.Cells.VerticalAlignment = xlVAlignBottom
       
    Next I
End Sub

Author

Commented:
Hi VipulKadia,

Thanks for the help

Explore More ContentExplore courses, solutions, and other research materials related to this topic.