Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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
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
variable height variable width stacked bar charts ambthiru Charts and Charting in Excel 3 January 18th 06 11:41 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM


All times are GMT +1. The time now is 02:33 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"