Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Simple delete macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Simple delete macro

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

"LiAD" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Simple delete macro

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

"LiAD" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Simple delete macro

Lovely,

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

Thanks for the reminder.

"Mike H" wrote:

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

"LiAD" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Simple delete macro

You are welcome! Thanks for the feedback!
Stefi

€˛LiAD€¯ ezt Ć*rta:

Lovely,

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

Thanks for the reminder.

"Mike H" wrote:

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

"LiAD" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Simple delete macro

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:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:16 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Simple For-Loop gives 1004 error using variable to EntireRow.Delete EdMX Excel Programming 3 December 2nd 04 02:43 AM
vba - need simple function to delete ranges tom g[_2_] Excel Programming 4 November 11th 04 06:58 PM


All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"