Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Delete all entries in selection except activecell

How can I delete all entries from a selection except for the currently active
cell?

In other words, if I have selected the range (A3:a12), I would like to
retain the value of A3 but delete the contents of all other cells.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Delete all entries in selection except activecell

Best bet is something like:

dim active_val as string

active_val = activecell.value

with selection
..clearcontents
end with

activecell.value = active_val


"Elaine" wrote:

How can I delete all entries from a selection except for the currently active
cell?

In other words, if I have selected the range (A3:a12), I would like to
retain the value of A3 but delete the contents of all other cells.

Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Delete all entries in selection except activecell

Thank you very much for your help.

"Naomi" wrote:

Best bet is something like:

dim active_val as string

active_val = activecell.value

with selection
.clearcontents
end with

activecell.value = active_val


"Elaine" wrote:

How can I delete all entries from a selection except for the currently active
cell?

In other words, if I have selected the range (A3:a12), I would like to
retain the value of A3 but delete the contents of all other cells.

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete all entries in selection except activecell

Safer/more robust would be to user the formula property which will preserve
either formula or value

dim active_val as string

active_val = activecell.Formula

with selection
..clearcontents
end with

activecell.Formula = active_val

--
Regards,
Tom Ogilvy


"Elaine" wrote in message
...
Thank you very much for your help.

"Naomi" wrote:

Best bet is something like:

dim active_val as string

active_val = activecell.value

with selection
.clearcontents
end with

activecell.value = active_val


"Elaine" wrote:

How can I delete all entries from a selection except for the currently

active
cell?

In other words, if I have selected the range (A3:a12), I would like to
retain the value of A3 but delete the contents of all other cells.

Thanks for your help.



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
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Delete first character in ActiveCell Andy Excel Programming 8 November 17th 04 03:40 PM
Delete rows from activecell al Excel Programming 3 September 27th 04 01:07 PM
Use of Selection.Find & ActiveCell Steve Slechta[_2_] Excel Programming 4 November 19th 03 02:07 PM
Delete the row where the activecell is located with VBA Tim Zych[_2_] Excel Programming 0 July 19th 03 03:57 AM


All times are GMT +1. The time now is 02:34 AM.

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

About Us

"It's about Microsoft Excel"