Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Row select mode to highlight active row of active cell | Excel Discussion (Misc queries) | |||
run macro although blinking cursor is active in an active cell | Excel Programming | |||
referring to formula in a non active cell from active cell | Excel Discussion (Misc queries) | |||
I need to sort an active sheet using the col of the active cell | Excel Programming | |||
Copy from active sheet and paste into new sheet using info from cell in active | Excel Programming |