ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Property let / get question (https://www.excelbanter.com/excel-programming/321305-property-let-get-question.html)

Rob

Property let / get question
 
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long


Rob van Gelder[_4_]

Property let / get question
 
The line Private SheetRow As Long needs to come before the Property Let /
Property Get statements.

It's due to the way the compiler works.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob" wrote in message
...
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long




NickHK

Property let / get question
 
Rob,
Is it a quiz ?

NickHK

P.S. Do you get a compile error ?

"Rob" wrote in message
...
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long




Rob

Property let / get question
 
suppose it did sount a bit like a quiz, sorry about that. It tells me that
the variable's not defined. (SheetRow that is)

"NickHK" wrote:

Rob,
Is it a quiz ?

NickHK

P.S. Do you get a compile error ?

"Rob" wrote in message
...
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long





Rob

Property let / get question
 
It tells me that SheetRow is not defined.

"NickHK" wrote:

Rob,
Is it a quiz ?

NickHK

P.S. Do you get a compile error ?

"Rob" wrote in message
...
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long





Rob van Gelder[_4_]

Property let / get question
 
Read my post - the compiler needs SheetRow declared before using it in
Propery Let/Set

Make sure the line Private SheetRow As Long is at the top of the code


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob" wrote in message
...
suppose it did sount a bit like a quiz, sorry about that. It tells me
that
the variable's not defined. (SheetRow that is)

"NickHK" wrote:

Rob,
Is it a quiz ?

NickHK

P.S. Do you get a compile error ?

"Rob" wrote in message
...
what's wrong with this???

Property Let DatabaseRow(Value As Long)
If SheetRow = 0 Then SheetRow = Value
End Property
Property Get DatabaseRow() As Long
DatabaseRow = SheetRow
End Property
Private SheetRow As Long








All times are GMT +1. The time now is 09:18 PM.

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