Simple delete macro

L

LiAD

Good afternoon,

Could somebody show me a simple macro please for how to delete entries in
cells.
I have text in cells B4-AA20 that I wanted to be able to delete by a macro.

Thanks
LD
 
B

Bob Flanagan

If you have already selected the range, then

Selection.ClearContents

or

Range("B4:AA20").ClearContents

You can find a lot of macro commands by just recording a macro via Tools,
Macros, Record (pre 2007 command)

Robert Flanagan
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
M

Mike H

Hi,

At it's simplest this will do it

Range("B4:AA20").ClearContents

Be aware that this deletes everything in that range, if that's not what you
want then post back.

Mike
 
S

Stefi

If you select range B4:AA20 and press Delete while recording a macro then
you get this sub:

Sub Macro1()
Range("B4:AA20").Select
Selection.ClearContents
End Sub

You can then edit it this way if you prefer compact code:
Sub Macro1()
Range("B4:AA20").ClearContents
End Sub


Regards,
Stefi

„LiAD†ezt írta:
 
L

LiAD

Lovely,

I'd forgotten the simple way to record macros rather than writing code.

Thanks for the reminder.
 
Top