We help IT Professionals succeed at work.

Delete Data

Cartillo
Cartillo asked
on
Hi Experts,

I would like to request Experts help to add additional function in the attached script. Need to delete all data between B4:H291(Week 1 to Week 5) and also removed all fill color in this range. Hope Experts could help me add this feature in this macro.


Sub UnhidePeskyRows()

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

    For I = 1 To 5
        Set ws = Worksheets("Week" & I)
        
        LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row
        For J = LastRow To 3 Step -1
        
            Set rng = ws.Range("A" & J)
            

                rng.EntireRow.Hidden = False
                
        Next J
    Next I
End Sub

Open in new window

Comment
Watch Question

Software Professional
CERTIFIED EXPERT
Commented:
I think adding the following lines within the I loop (but outside of the J loop) would do:

        Set rng = ws.Range("B4:H291")
        rng.Clear

Author

Commented:
Hi,

Thanks

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