ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can one obtain the current selected cell value (https://www.excelbanter.com/excel-programming/318921-how-can-one-obtain-current-selected-cell-value.html)

susan hayes

how can one obtain the current selected cell value
 
If the user is on range("20c") how can I no this.
Have tried with activecell example in VBA help but does no give me any
value

Thanks



David

how can one obtain the current selected cell value
 
VaiableX = activecell.value

"Susan Hayes" wrote:

If the user is on range("20c") how can I no this.
Have tried with activecell example in VBA help but does no give me any
value

Thanks




Norman Jones

how can one obtain the current selected cell value
 
Hi Susan,

If the user is on range("20c")

I presume you mean Range("C20") .

how can I no this.


Sub Tester()
Dim rng As Range
Set rng = ActiveCell
MsgBox rng.Address(0, 0)
End Sub

---
Regards,
Norman



"Susan Hayes" wrote in message
...
If the user is on range("20c") how can I no this.
Have tried with activecell example in VBA help but does no give me any
value

Thanks





Bob Phillips[_6_]

how can one obtain the current selected cell value
 
Activecell returns the object that is the active cell. This object has many
properties that you can interrogate.

For instance, ACtivecell.Value will give you the actual value in that cell.
Activecell.Text will give you the text in that cell (for instance, if you
have a value of 1 in a cell, but it is formatted as currency, this will give
the text value of $1.00 as seen on the worksheet)
Activecell.Address gives the address string of that cell, such as $A$1.

There are many others, take a look at 'Range Object' in VBA help (Activecell
is just a specific example of a range), and look at the properties
associated with it to find out about more.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Susan Hayes" wrote in message
...
If the user is on range("20c") how can I no this.
Have tried with activecell example in VBA help but does no give me any
value

Thanks






All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com