Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Searching for Value.



I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C



This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.


What gives?






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Searching for Value.

Try an empty test instead of a numerical test:

Sub emptest()
If IsEmpty(Selection) Then
MsgBox ("empty")
End If
End Sub

--
Gary''s Student - gsnu200723


"Miaplacidus" wrote:



I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C



This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.


What gives?






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Searching for Value.

Thanks. I'll try it, although I think I did that. I think the problem was
that isempty returns "false" although there is nothing in the cell I can
find: not a blank space, and not an empty string, and not a number less than
..5, Nothing.

So how can the value be greater than zero? I tried greater than 1, and it
still runs.

The situation is that I have a bunch of rows with data in month coumns
(Yeah, I know. It wasn't my design, but I'm stuck with it.) and most months
are empty, so the code should skip over them. Sometimes it does, but
sometimes it finds something in the cell and reports out zero or blank data.
That then, causes other problems later. I'm sure that I am looking at the
right cell. Even if I'm not, the same problem happens multiple times in
adjacent cells.

Normally when I hover over a variable the value is shown, but for some
reason, that isnt working either. Or wasn't. Now it seems to be back on
again. For at least one case it reported a null string "". So I put in a
test for that, and now it seems to work.

ALSO, the help section says isempty only returns meaningful information for
type variant. Also the help says that isnumber, istext, and isnontext should
be available, but when I try them I get an error statement saying it isn't a
valid function. This whole problem would go away if isnumber() worked.

Any other ideas? I know this has to be a common problem.







"Gary''s Student" wrote:

Try an empty test instead of a numerical test:

Sub emptest()
If IsEmpty(Selection) Then
MsgBox ("empty")
End If
End Sub

--
Gary''s Student - gsnu200723


"Miaplacidus" wrote:



I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C



This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.


What gives?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Searching for Value.

Maybe you're on the wrong cell.

You could add a debugging line:

msgbox c.address & vblf & c.value & len(c.value)

To help find the problem cell.

Miaplacidus wrote:

I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C

This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.

What gives?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Searching for Value.

Nope. I'm certain I'm on the right cell. Still can't get the advertized Excel
functions to work in VBA.





"Dave Peterson" wrote:

Maybe you're on the wrong cell.

You could add a debugging line:

msgbox c.address & vblf & c.value & len(c.value)

To help find the problem cell.

Miaplacidus wrote:

I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C

This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.

What gives?


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Searching for Value.

The extra debug statement didn't help?

Sorry, I don't have another guess.

Miaplacidus wrote:

Nope. I'm certain I'm on the right cell. Still can't get the advertized Excel
functions to work in VBA.

"Dave Peterson" wrote:

Maybe you're on the wrong cell.

You could add a debugging line:

msgbox c.address & vblf & c.value & len(c.value)

To help find the problem cell.

Miaplacidus wrote:

I've got code:

for each c in range ....

If c.value 0 then

DoCode

End If
Next C

This was working fine, but suddenly it is executing Do Code whne c is blank.

What is wrong here.

When I test is Isnumeric returns true
The value returns blank and the length returns zero.

What gives?


--

Dave Peterson


--

Dave Peterson
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
Searching for #N/A [email protected] Excel Worksheet Functions 5 February 28th 07 01:23 PM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
searching for tab Kevin R Excel Discussion (Misc queries) 3 January 16th 06 08:55 PM
searching Tracy A Excel Worksheet Functions 2 July 28th 05 08:54 PM
Searching LC[_3_] Excel Programming 1 July 25th 03 12:29 AM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"