![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 03:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com