• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to clear cells

Hi Ninjas .. need some help with vba ..

I used a vba script connected to a button that runs for sheet1 to clear columns A:J, how can I also make this work for sheet2 B:E & for sheet3 column that starts B4:E4 going down to the last cell that has data. thanks in advance guys!


Sub Clear_Stuff()
Dim lngLastRow As Long
lngLastRow = Cells(Rows.Count, 3).End(xlUp).Row
Range("A:J").Clear
End Sub
 
Hi Hui,

The script I posted above works, but I would also want it to work for the other sheets when I click on the button that I created.
 
Method 1 - Inside a "for each sheet" loop use if - else for each sheet and define the range for each sheet in code itself
 
Back
Top