Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to Bind VBA Variable to Range().Value2 Property

I want to use Excel VBA variables in modules and classes as "shorthand" for
the Range().Value2 property. I tried using declarations like:

Dim Variable As Double
Set Variable = Range("Cell Reference").Value2

Is there some way to use data binding in VBA to "link" a variable to a Named
cell property?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default How to Bind VBA Variable to Range().Value2 Property

Option Explicit

Public Property Get MyValue() As Double
MyValue = Range("Cell.Reference").Value2
End Property


"MachAngle" wrote:

I want to use Excel VBA variables in modules and classes as "shorthand" for
the Range().Value2 property. I tried using declarations like:

Dim Variable As Double
Set Variable = Range("Cell Reference").Value2

Is there some way to use data binding in VBA to "link" a variable to a Named
cell property?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default How to Bind VBA Variable to Range().Value2 Property

create the property, then use it in your code exactly as if it were a
'normal' variable

eg

x= myvalue * 2



"Patrick Molloy" wrote:

Option Explicit

Public Property Get MyValue() As Double
MyValue = Range("Cell.Reference").Value2
End Property


"MachAngle" wrote:

I want to use Excel VBA variables in modules and classes as "shorthand" for
the Range().Value2 property. I tried using declarations like:

Dim Variable As Double
Set Variable = Range("Cell Reference").Value2

Is there some way to use data binding in VBA to "link" a variable to a Named
cell property?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to Bind VBA Variable to Range().Value2 Property

Looks straight forward.... Thanks!

"Patrick Molloy" wrote:

create the property, then use it in your code exactly as if it were a
'normal' variable

eg

x= myvalue * 2



"Patrick Molloy" wrote:

Option Explicit

Public Property Get MyValue() As Double
MyValue = Range("Cell.Reference").Value2
End Property


"MachAngle" wrote:

I want to use Excel VBA variables in modules and classes as "shorthand" for
the Range().Value2 property. I tried using declarations like:

Dim Variable As Double
Set Variable = Range("Cell Reference").Value2

Is there some way to use data binding in VBA to "link" a variable to a Named
cell property?

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
Early bind to Late bind Henk Excel Programming 3 February 13th 09 12:59 AM
Excel & C# NullReference Error when trying to set Range.Value2 Chuck Excel Programming 1 August 2nd 06 11:01 PM
Range.Value2 is failing for lenghty strings Naresh Mirkhelkar Excel Programming 4 June 9th 06 02:54 PM
Merged cells Value2 property Sandrina Excel Programming 1 February 6th 06 02:58 PM
range variable won't assign (chartobject.topleftcell property) Matthew Dodds Excel Programming 2 November 16th 05 02:25 PM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"