ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   singel cell reference (https://www.excelbanter.com/excel-programming/387480-singel-cell-reference.html)

Guye

singel cell reference
 
hi all,
how do i make a reference to a single specific cell (for example D1)
in a amcro
thanks


Norman Jones

singel cell reference
 
Hi Guye,

'-------------------
how do i make a reference to a single specific cell (for example D1)
in a amcro
'-------------------

I suspect that there may be more to your question than
is immediately apparent, but try something like:

'=============
Public Sub Tester()
Dim rng As Range

Set rng = Range("D1")
MsgBox rng.Address(0, 0)

End Sub
'<<=============


---
Regards,
Norman



Carl Hartness[_2_]

singel cell reference
 
The default property for the range object is Value, so in most cases,
you can use Range("D1") directly
a = Range("D1") * 10
As you get deeper into VBA, you may hit cases where Range("D1").Value
is specifically needed.

Carl.

On Apr 16, 4:20 am, "Norman Jones"
wrote:
Hi Guye,

'-------------------
how do i make a reference to a single specific cell (for example D1)
in a amcro
'-------------------

I suspect that there may be more to your question than
is immediately apparent, but try something like:

'=============
Public Sub Tester()
Dim rng As Range

Set rng = Range("D1")
MsgBox rng.Address(0, 0)

End Sub
'<<=============

---
Regards,
Norman



Norman Jones

singel cell reference
 
Hi Carl,

'---------------
The default property for the range object is Value, so in most cases,
you can use Range("D1") directly
a = Range("D1") * 10
As you get deeper into VBA, you may hit cases where Range("D1").Value
is specifically needed.
'---------------

I assume that your response was intended for Guye.

However, I would strongly advocate the required property be
stated explicitly, rather than relying on a default value.


---
Regards,
Norman




All times are GMT +1. The time now is 10:48 AM.

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