Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've always have trouble with this one could someone help?
I can determine if a cell has a numeric value but not a string value. Sometimes I can get it to work but for some reason it's not very reliable? As a result need a more definate code. I have attached the macro, it is range 02 that is giving me grieve If Range(range01) 0 And Range(range02) < 0 Then It was as below which worked sometimes works If Range("B1") = "" And Range("C1") < "" Then |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=ISNUMBER(xx) will return true if location xx has a numeric value and
false other wise. Doug |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recently was looking for something like this myself. Below is what I
used to solve my problem. If InStr(ActiveCell, SearchItem) 0 Then ' where SearchItem was a string value that I have as a user input In the definition of InStr, the first notation is said to be [Start]. The problem I ran into was I could only get it to search one cell, and then force it to .Offset right or down one to suit my need. The way I understood it was that if InStr finds what its looking for it returns a number value higher than 0, thus ' 0 ' would be necessary. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the text property of the range and it will always be a string.
Beyond that, you would need a clearer explanation of what you problem is. -- Regards, Tom Ogilvy "Rob" wrote in message ... I've always have trouble with this one could someone help? I can determine if a cell has a numeric value but not a string value. Sometimes I can get it to work but for some reason it's not very reliable? As a result need a more definate code. I have attached the macro, it is range 02 that is giving me grieve If Range(range01) 0 And Range(range02) < 0 Then It was as below which worked sometimes works If Range("B1") = "" And Range("C1") < "" Then |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for prompt reply, I'm not quite sure what you mean by text properties?
Is that Cell format? as I'm trying to avoid listing of possible variables "Tom Ogilvy" wrote: Use the text property of the range and it will always be a string. Beyond that, you would need a clearer explanation of what you problem is. -- Regards, Tom Ogilvy "Rob" wrote in message ... I've always have trouble with this one could someone help? I can determine if a cell has a numeric value but not a string value. Sometimes I can get it to work but for some reason it's not very reliable? As a result need a more definate code. I have attached the macro, it is range 02 that is giving me grieve If Range(range01) 0 And Range(range02) < 0 Then It was as below which worked sometimes works If Range("B1") = "" And Range("C1") < "" Then |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for prompt reply, it's not the number I'm after, is ther a code for a
string Value? "Doug" wrote: =ISNUMBER(xx) will return true if location xx has a numeric value and false other wise. Doug |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for prompt reply, I think I understand, will try it on Monday, as I'm
finishing for the day. Have a good weekend. "Brtw" wrote: I recently was looking for something like this myself. Below is what I used to solve my problem. If InStr(ActiveCell, SearchItem) 0 Then ' where SearchItem was a string value that I have as a user input In the definition of InStr, the first notation is said to be [Start]. The problem I ran into was I could only get it to search one cell, and then force it to .Offset right or down one to suit my need. The way I understood it was that if InStr finds what its looking for it returns a number value higher than 0, thus ' 0 ' would be necessary. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The text property or a single cell range returns the displayed value of the
cell. It is always a string. If the cell contains zero, then cell.Text would be "0" So instead of using cell = 0, (which is really cell.value = 0), you could use cell.Text = "0" My answer was just a guess, however, because it really isn't clear what you are asking. (note the variety of answers you received) -- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks for prompt reply, I'm not quite sure what you mean by text properties? Is that Cell format? as I'm trying to avoid listing of possible variables "Tom Ogilvy" wrote: Use the text property of the range and it will always be a string. Beyond that, you would need a clearer explanation of what you problem is. -- Regards, Tom Ogilvy "Rob" wrote in message ... I've always have trouble with this one could someone help? I can determine if a cell has a numeric value but not a string value. Sometimes I can get it to work but for some reason it's not very reliable? As a result need a more definate code. I have attached the macro, it is range 02 that is giving me grieve If Range(range01) 0 And Range(range02) < 0 Then It was as below which worked sometimes works If Range("B1") = "" And Range("C1") < "" Then |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determining AM or PM in text string | Excel Worksheet Functions | |||
Determining text in a cell | Excel Programming | |||
Determining active conditional format of one cell | Excel Programming | |||
Determining Cell Types in Excel - exceptions | Excel Programming | |||
Determining whether selected cell has value or formula? | Excel Programming |