Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default number as text confusing code

I am currently using code to create a table which includes all of the
categories found in a list and the number of times each category is found in
the list.
As part of this, I have the following line of code:
If item = Cells(u + 1, "AR") Then

This works great except in once instance where "item" or the contents of
cell(u+1, "AR") may be "0". Is there a way to re-write the line so that it
is not confused by a number as text?

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default number as text confusing code

One thing you can do is to do a find and replace on 0. When the replace is
done, the text "0" should be magically transformed to the number 0.

HTH

"Papa Jonah" wrote:

I am currently using code to create a table which includes all of the
categories found in a list and the number of times each category is found in
the list.
As part of this, I have the following line of code:
If item = Cells(u + 1, "AR") Then

This works great except in once instance where "item" or the contents of
cell(u+1, "AR") may be "0". Is there a way to re-write the line so that it
is not confused by a number as text?

TIA

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default number as text confusing code

I don't want text to be numbers. I want the number to be read as text.

"Jim Thomlinson" wrote:

One thing you can do is to do a find and replace on 0. When the replace is
done, the text "0" should be magically transformed to the number 0.

HTH

"Papa Jonah" wrote:

I am currently using code to create a table which includes all of the
categories found in a list and the number of times each category is found in
the list.
As part of this, I have the following line of code:
If item = Cells(u + 1, "AR") Then

This works great except in once instance where "item" or the contents of
cell(u+1, "AR") may be "0". Is there a way to re-write the line so that it
is not confused by a number as text?

TIA

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default number as text confusing code

If cstr(item) = Cells(u + 1, "AR").Text Then

perhaps.

--
Regards,
Tom Ogilvy


"Papa Jonah" wrote in message
...
I don't want text to be numbers. I want the number to be read as text.

"Jim Thomlinson" wrote:

One thing you can do is to do a find and replace on 0. When the replace

is
done, the text "0" should be magically transformed to the number 0.

HTH

"Papa Jonah" wrote:

I am currently using code to create a table which includes all of the
categories found in a list and the number of times each category is

found in
the list.
As part of this, I have the following line of code:
If item = Cells(u + 1, "AR") Then

This works great except in once instance where "item" or the contents

of
cell(u+1, "AR") may be "0". Is there a way to re-write the line so

that it
is not confused by a number as text?

TIA



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
convert text string to a number code ramon Excel Discussion (Misc queries) 5 April 11th 07 05:02 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Convert text strings to a code or number MaxNY23 Excel Worksheet Functions 15 March 23rd 06 10:47 PM
Modified VB Code for Converting Number to Text shashidharga[_4_] Excel Programming 1 October 4th 04 07:18 PM
Modified VB Code for Converting Number to Text shashidharga[_3_] Excel Programming 4 October 3rd 04 01:11 PM


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