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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,775
Messages
6,126,828
Members
449,342
Latest member
Max1mus Laz3r

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