Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Retaining Selected area

A question was posed earlier today about how to retain the address of the
activecell and Bob Philips gave this as a solution:
Set oCell = Activecell
' do your stuff elsewhere
oCell.Select
Is there a way for one to retain a selected area, do a few things and then
go back to the original area selected?

Set oRange=Selection and oRange.Select after doing other things did not seem
to work for me --but that might be my ineptitude.

Specifically, I would like to delete all items other than an activecell in a
selected range. I am able to do this manually but am not able to record it --
as the recorder doesn't seem to record CTRL + . (period) satisfactorily. The
way I do it manually is:
Press Ctrl + .
Shift + down arrow
Press Delete key
Shift + Up arrow

Thank you for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Retaining Selected area

Elaine,

How about:

Dim myVal As Variant

myVal = ActiveCell.Value
Selection.ClearContents
ActiveCell.Value = myVal

HTH,
Bernie
MS Excel MVP

"Elaine" wrote in message
...
A question was posed earlier today about how to retain the address of the
activecell and Bob Philips gave this as a solution:
Set oCell = Activecell
' do your stuff elsewhere
oCell.Select
Is there a way for one to retain a selected area, do a few things and then
go back to the original area selected?

Set oRange=Selection and oRange.Select after doing other things did not

seem
to work for me --but that might be my ineptitude.

Specifically, I would like to delete all items other than an activecell in

a
selected range. I am able to do this manually but am not able to record

it --
as the recorder doesn't seem to record CTRL + . (period) satisfactorily.

The
way I do it manually is:
Press Ctrl + .
Shift + down arrow
Press Delete key
Shift + Up arrow

Thank you for your help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Retaining Selected area

Thank you very much Bernie. This is what I wanted.

I also wanted to say that Bob Philips' code worked for retaining selections
as well. As usual it was my mistake.

"Bernie Deitrick" wrote:

Elaine,

How about:

Dim myVal As Variant

myVal = ActiveCell.Value
Selection.ClearContents
ActiveCell.Value = myVal

HTH,
Bernie
MS Excel MVP

"Elaine" wrote in message
...
A question was posed earlier today about how to retain the address of the
activecell and Bob Philips gave this as a solution:
Set oCell = Activecell
' do your stuff elsewhere
oCell.Select
Is there a way for one to retain a selected area, do a few things and then
go back to the original area selected?

Set oRange=Selection and oRange.Select after doing other things did not

seem
to work for me --but that might be my ineptitude.

Specifically, I would like to delete all items other than an activecell in

a
selected range. I am able to do this manually but am not able to record

it --
as the recorder doesn't seem to record CTRL + . (period) satisfactorily.

The
way I do it manually is:
Press Ctrl + .
Shift + down arrow
Press Delete key
Shift + Up arrow

Thank you 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
Printing selected area Nunya Excel Discussion (Misc queries) 1 February 6th 08 07:16 PM
Highlight selected area dkallen Excel Discussion (Misc queries) 4 September 12th 07 04:52 PM
Capitalizing selected area J.E Excel Discussion (Misc queries) 3 March 30th 05 10:10 PM
VBA - Only Selected area visible Geo Siggy[_3_] Excel Programming 2 February 3rd 04 03:16 PM
create gif of selected area that is not a chart Snorre Olav Holand Excel Programming 1 November 1st 03 08:37 PM


All times are GMT +1. The time now is 07:57 PM.

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"