Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.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 |
#2
Posted to microsoft.public.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 "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
before variable contains a value
Peter,
Can you declare it as variant and test IsEmpty(Kpl)? -- HTH ------- Bob Phillips "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
variable height variable width stacked bar charts | Charts and Charting in Excel | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming |