|
|
before variable contains a value |
|
Author |
Message |
leodippolito
|
Posted: Fri Dec 17 18:01:10 CST 2004 |
Top |
Excel Programming >> before variable contains a value
Hi all,
This is (part of) what I have:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Kpl as long
If Target.Value <> "" Then Kpl = Target.Value
...
I hope this is enough to answer the following question.
If I press delete, therefore starting the event, the variable does not yet
have a value and according to the line of code in the if-construct, it won't
get a value either.
How can you use this state of "emptyness" the variable has at that time if
you want to do something like a test and you do not want this "emptyness" to
be confused with 0?
Thanks,
Peter
Excel158
|
|
|
|
|
Tom
|
Posted: Fri Dec 17 18:01:10 CST 2004 |
Top |
Excel Programming >> before variable contains a value
Dim Kpl as Long
Kpl is initialized as zero, so it doesn't have a state of emptyness.
You could continue to test Target.
--
Regards,
Tom Ogilvy
> Hi all,
>
> This is (part of) what I have:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> Dim Kpl as long
>
> If Target.Value <> "" Then Kpl = Target.Value
>
> ...
>
> I hope this is enough to answer the following question.
>
> If I press delete, therefore starting the event, the variable does not yet
> have a value and according to the line of code in the if-construct, it
won't
> get a value either.
>
> How can you use this state of "emptyness" the variable has at that time if
> you want to do something like a test and you do not want this "emptyness"
to
> be confused with 0?
>
> Thanks,
> Peter
>
>
|
|
|
|
|
Bob
|
Posted: Fri Dec 17 18:04:46 CST 2004 |
Top |
Excel Programming >> before variable contains a value
Peter,
Can you declare it as variant and test IsEmpty(Kpl)?
--
HTH
-------
Bob Phillips
> Hi all,
>
> This is (part of) what I have:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> Dim Kpl as long
>
> If Target.Value <> "" Then Kpl = Target.Value
>
> ...
>
> I hope this is enough to answer the following question.
>
> If I press delete, therefore starting the event, the variable does not yet
> have a value and according to the line of code in the if-construct, it
won't
> get a value either.
>
> How can you use this state of "emptyness" the variable has at that time if
> you want to do something like a test and you do not want this "emptyness"
to
> be confused with 0?
>
> Thanks,
> Peter
>
>
|
|
|
|
|
|
|