clear contents vba

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
193
Hi! having some issues with my clear contents vba.

I want to clear anything thats in A7:J, there may be some cells with no data, or 0s, basically want to clear anything thats listed there.

I tried the below ,and it doesnt appear to clear everything.

VBA Code:
lr = ActiveSheet.Range("A7:A" & Rows.Count).Find("").Row - 1
Set clrrng = Range("A7:J" & lr)
clrrng.ClearContents

Any ideas? Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this:
VBA Code:
'   Find last used row on sheet
    Dim lr As Long
    lr = ActiveCell.SpecialCells(xlLastCell).Row
   
'   Clear from A7 down to last row with column J
    Range("A7:J" & lr).ClearContents
 
Upvote 0
Solution

Forum statistics

Threads
1,215,110
Messages
6,123,140
Members
449,098
Latest member
Doanvanhieu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top