Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determining A Cell If it contain A string value

=ISNUMBER(xx) will return true if location xx has a numeric value and
false other wise.

Doug

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Determining A Cell If it contain A string value

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determining A Cell If it contain A string value

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
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
Determining AM or PM in text string Bob Excel Worksheet Functions 8 October 27th 06 12:55 PM
Determining text in a cell ZABU Excel Programming 4 July 2nd 04 04:44 AM
Determining active conditional format of one cell Antonio[_3_] Excel Programming 1 November 27th 03 12:38 AM
Determining Cell Types in Excel - exceptions Tim Childs[_6_] Excel Programming 5 October 23rd 03 04:28 AM
Determining whether selected cell has value or formula? John Wirt Excel Programming 3 July 31st 03 04:19 AM


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