Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching for #N/A | Excel Worksheet Functions | |||
Searching, matching then searching another list based on the match | Excel Discussion (Misc queries) | |||
searching for tab | Excel Discussion (Misc queries) | |||
searching | Excel Worksheet Functions | |||
Searching | Excel Programming |