View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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

"Peter" wrote in message
...
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