Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Error: If Range("AZ" & intCounter).Text = "" Then

I have a very strange error in Excel 2003:

All cells in column AZ are empty. When I run this code:

If Range("AZ" & intCounter).Text = "" Then

it says that the cells contain the value TRUE.

How can this be possible?

Very grateful for help!

// S
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Error: If Range("AZ" & intCounter).Text = "" Then

Hi,

I'm not sure I fully understand what you mean but if you apply the test

If Range("AZ" & intCounter).Text = "" Then

to the cells and they are empty then that will evaluate as TRUE, it doesn't
mean the cell contains the value TRUE. For example try this small routine on
your cells

Sub nnn()
For intcounter = 1 To 20
If Range("AZ" & intcounter).Text = "" Then
MsgBox Range("AZ" & intcounter).Text = ""
Else
MsgBox Range("AZ" & intcounter).Text = ""
End If
Next
End Sub

Empty cell evalute as TRUE and populated cells evaluate as FALSE

Mike

" wrote:

I have a very strange error in Excel 2003:

All cells in column AZ are empty. When I run this code:

If Range("AZ" & intCounter).Text = "" Then

it says that the cells contain the value TRUE.

How can this be possible?

Very grateful for help!

// S

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Error: If Range("AZ" & intCounter).Text = "" Then

I should add that if a cell in your range contains a formula such as

=if(A1="","","")

which would always return a null string then your test would evaluate as
TRUE for this cell despite it containing a formula.

Mike

" wrote:

I have a very strange error in Excel 2003:

All cells in column AZ are empty. When I run this code:

If Range("AZ" & intCounter).Text = "" Then

it says that the cells contain the value TRUE.

How can this be possible?

Very grateful for help!

// S

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Error: If Range("AZ" & intCounter).Text = "" Then

You are applying a logical test...... if is = "" ....which will evaluate
TRUE, if the cell is empty, FALSE otherwise.

--

Regards,
Nigel




wrote in message
...
I have a very strange error in Excel 2003:

All cells in column AZ are empty. When I run this code:

If Range("AZ" & intCounter).Text = "" Then

it says that the cells contain the value TRUE.

How can this be possible?

Very grateful for help!

// S


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Error: If Range("AZ" & intCounter).Text = "" Then

After some more testing I've found that the problem is that
"Range("AZ" & intCounter).Text" returns nothing if the cell content
only contains numbers. If I change to "Range("AZ" & intCounter).Value"
it returns the content also if the content only is a number. Why
doesn't it return the content with .Text?

// S



On 21 Jan, 10:52, "Nigel" wrote:
You are applying a logical test...... if is = "" ....which will evaluate
TRUE, *if the cell is empty, FALSE otherwise.

--

Regards,
Nigel


wrote in message

...



I have a very strange error in Excel 2003:


All cells in column AZ are empty. When I run this code:


If Range("AZ" & intCounter).Text = "" Then


it says that the cells contain the value TRUE.


How can this be possible?


Very grateful for help!


// S- Dölj citerad text -


- Visa citerad text -




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Error: If Range("AZ" & intCounter).Text = "" Then

Hi,

I'm not sure how you tested and came up with the result you did but

MsgBox Range("AZ" & intcounter).Text

Will return a number if that's what's in the cell

Mike

" wrote:

After some more testing I've found that the problem is that
"Range("AZ" & intCounter).Text" returns nothing if the cell content
only contains numbers. If I change to "Range("AZ" & intCounter).Value"
it returns the content also if the content only is a number. Why
doesn't it return the content with .Text?

// S



On 21 Jan, 10:52, "Nigel" wrote:
You are applying a logical test...... if is = "" ....which will evaluate
TRUE, if the cell is empty, FALSE otherwise.

--

Regards,
Nigel


wrote in message

...



I have a very strange error in Excel 2003:


All cells in column AZ are empty. When I run this code:


If Range("AZ" & intCounter).Text = "" Then


it says that the cells contain the value TRUE.


How can this be possible?


Very grateful for help!


// S- Dölj citerad text -


- Visa citerad text -



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Error Help - Method "Range" of object "_Worksheet" failed. Alan Smith Excel Programming 3 March 15th 07 06:55 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM
"Subscript out of range" error for: Workbooks("Test1.xls").Save Just12341234 Excel Programming 2 June 17th 05 03:16 PM


All times are GMT +1. The time now is 01:37 PM.

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"