#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Active Cell

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Active Cell

A range object contains a lot of information including the value, the
address, and formating. If you want the address then use the following

MsgBox = "You are currently in Cell " & ActiveCell.address


"Ronio" wrote:

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Active Cell

Lose the = and add .address

MsgBox "You are currently in Cell " & ActiveCell.Address


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ronio" wrote in message
...
I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not
the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Active Cell

Ronio
The ActiveCell property only returns the upper left cell of the selected
range (which is indeed a range object). But, if you want to return the whole
range, then use the RangeSelection property instead.

"Ronio" wrote:

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Active Cell

Not always...

If you select A1:E9 and hit the tab a few times, you'll see the activecell
changing, but the selection doesn't change.

And you could use plain old Selection instead of RangeSelection.

joeeng wrote:

Ronio
The ActiveCell property only returns the upper left cell of the selected
range (which is indeed a range object). But, if you want to return the whole
range, then use the RangeSelection property instead.

"Ronio" wrote:

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Active Cell

Thank you for pointing that out. But I believe that immediately following a
range selection, activecell is the upper left cell of the selection range.

Following your first thread, then there is a diiference between Selection
and SelectionRange. If an image or chart is selected after the range
selection, then Selection will return the image or chart and not the range,
while RangeSelection will return the last selected range. Is this not
correct?

"Dave Peterson" wrote:

Not always...

If you select A1:E9 and hit the tab a few times, you'll see the activecell
changing, but the selection doesn't change.

And you could use plain old Selection instead of RangeSelection.

joeeng wrote:

Ronio
The ActiveCell property only returns the upper left cell of the selected
range (which is indeed a range object). But, if you want to return the whole
range, then use the RangeSelection property instead.

"Ronio" wrote:

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Active Cell

But who knows what was selected and when--or what was activated?

And I think if I were writing a macro that depended on the current selection, I
think I'd use selection, but make sure it was a range.

If TypeName(Selection) < "Range" Then
MsgBox "please select a range"
Exit Sub
End If

But yep, activewindow.selectionrange will return a range object.



joeeng wrote:

Thank you for pointing that out. But I believe that immediately following a
range selection, activecell is the upper left cell of the selection range.

Following your first thread, then there is a diiference between Selection
and SelectionRange. If an image or chart is selected after the range
selection, then Selection will return the image or chart and not the range,
while RangeSelection will return the last selected range. Is this not
correct?

"Dave Peterson" wrote:

Not always...

If you select A1:E9 and hit the tab a few times, you'll see the activecell
changing, but the selection doesn't change.

And you could use plain old Selection instead of RangeSelection.

joeeng wrote:

Ronio
The ActiveCell property only returns the upper left cell of the selected
range (which is indeed a range object). But, if you want to return the whole
range, then use the RangeSelection property instead.

"Ronio" wrote:

I'm confused, the help file states that ActiveCell would return the range
object.

However, when I call ActiveCell , I"m getting the value of the cell not the
range??

MsgBox = "You are currently in Cell " & ActiveCell

How can I return the Cell that is currently selected?

Ron


--

Dave Peterson


--

Dave Peterson
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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
run macro although blinking cursor is active in an active cell bartman1980 Excel Programming 1 December 20th 07 11:29 AM
referring to formula in a non active cell from active cell nickname Excel Discussion (Misc queries) 1 June 21st 07 12:11 PM
I need to sort an active sheet using the col of the active cell HamFlyer Excel Programming 3 June 6th 06 07:25 PM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Excel Programming 3 January 23rd 06 09:57 PM


All times are GMT +1. The time now is 12:11 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"