Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default NOW I'm puzzled???

I have a list of 100 items, which is identifyed by a formula in
Range("A" & Row).

If I decide to delete all rows where the formula in Range("A") gives an
empty string, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Rows(Counter).Delete
Next

Everything works fine... ...but...

....if I instead decide to clear the formulas, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Range("A" &
Counter).ClearContents
Next

Each and every cell gets cleared, even if the formula produces a value!!!

WHY?!?
What's the difference?!?

Why is the formulas result recognized as a value in one instance, and
not in the other???

Can someone explain?


CE
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default NOW I'm puzzled???

On Sun, 01 Jul 2012 18:52:11 +0200, "Charlotte E." wrote:

I have a list of 100 items, which is identifyed by a formula in
Range("A" & Row).

If I decide to delete all rows where the formula in Range("A") gives an
empty string, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Rows(Counter).Delete
Next

Everything works fine... ...but...

...if I instead decide to clear the formulas, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Range("A" &
Counter).ClearContents
Next

Each and every cell gets cleared, even if the formula produces a value!!!

WHY?!?
What's the difference?!?

Why is the formulas result recognized as a value in one instance, and
not in the other???

Can someone explain?



download a copy of a file demonstrating the problem to one of the public file-sharing sites (e.g. Skydrive). There is most likely something causing this to occur in details you have not shared here.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default NOW I'm puzzled???

Charlotte E. wrote:

I have a list of 100 items, which is identifyed by a formula in
Range("A" & Row).

If I decide to delete all rows where the formula in Range("A") gives an
empty string, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Rows(Counter).Delete
Next

Everything works fine... ...but...

...if I instead decide to clear the formulas, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Range("A" &
Counter).ClearContents
Next

Each and every cell gets cleared, even if the formula produces a value!!!

WHY?!?
What's the difference?!?

Why is the formulas result recognized as a value in one instance, and
not in the other???

Can someone explain?


Works as expected for me, in a quick 10-second test. What other code do you
have running?

--
- Things aren't always so black and white.
- You're right. The important things are just green.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default NOW I'm puzzled???

You are right, guys :-)

Simply a matter of using either 'Ascending' or 'Descending' when sorting
the list :-)

Stupid me!

Thanks for your time anyway....

CE


Den 01.07.2012 18:52, Charlotte E. skrev:
I have a list of 100 items, which is identifyed by a formula in
Range("A" & Row).

If I decide to delete all rows where the formula in Range("A") gives an
empty string, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Rows(Counter).Delete
Next

Everything works fine... ...but...

....if I instead decide to clear the formulas, like this:

For Counter = 100 To 2 Step -1
If Range("A" & Counter).Value = "" Then Range("A" & Counter).ClearContents
Next

Each and every cell gets cleared, even if the formula produces a value!!!

WHY?!?
What's the difference?!?

Why is the formulas result recognized as a value in one instance, and
not in the other???

Can someone explain?


CE

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
Sorting issue has got me puzzled! anon Excel Programming 1 July 20th 08 02:39 PM
Sorting issue has got me puzzled! anon Excel Programming 0 July 20th 08 01:32 PM
puzzled chapm4 Excel Worksheet Functions 1 August 24th 05 08:41 PM
&quot... whats this??? am puzzled aken Excel Programming 4 June 20th 05 02:05 PM
EASY ONE ! using countIF.. puzzled justin_vasko Excel Discussion (Misc queries) 4 May 25th 05 05:13 PM


All times are GMT +1. The time now is 03:45 PM.

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"