Active Cell

  • Thread starter Thread starter Ronio
  • Start date Start date
R

Ronio

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
 
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
 
Lose the = and add .address

MsgBox "You are currently in Cell " & ActiveCell.Address
 
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.
 
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.
 
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?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top