Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Help ... what wrong with this code


Column N is value - Column A is the result

here is the code:

Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[13]80000,""$80,000 or above"",IF(RC[13]70000,""$70,000 -
$79,999"",IF(RC[13]60000,""$60,000 - $69,999"",IF(RC[13]50000,""$50,000 -
$59,999"",IF(RC[13]40000,""$40,000 - $49,999"",IF(RC[13]30000,""$30,000 -
$39,999"",IF(RC[13]20000,""$20,000 - $29,999"",IF(RC[13]15000,""$15,000 -
$15,999"",""$15,000 or below""))))))))"

but in Column A they all give me the result is: $80,000 or above
Even the amount is only 5000

Please Help


Best Regards




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help ... what wrong with this code

Range("A2") is your ActiveCell because you Select it in your code, so putting
your cursor elsewhere on the sheet would do no good since the code will move
it back to A2. Therefore, whatever is in Range("N2) is what will be
evaluated. So, unless you are changing the value in N2, you are going to get
a consistent result in A2.

Also, I noticed that your gradations are set as 15000, 20000. 30000, etc.
You should probably make them 14999, 19999, 29999, etc. to match your
messages that will show in column A. Otherwise, $20, 000 will give you a
message of "$15,000 or below" and so on up the line at each break point.

"Chuong Nguyen" wrote:


Column N is value - Column A is the result

here is the code:

Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[13]80000,""$80,000 or above"",IF(RC[13]70000,""$70,000 -
$79,999"",IF(RC[13]60000,""$60,000 - $69,999"",IF(RC[13]50000,""$50,000 -
$59,999"",IF(RC[13]40000,""$40,000 - $49,999"",IF(RC[13]30000,""$30,000 -
$39,999"",IF(RC[13]20000,""$20,000 - $29,999"",IF(RC[13]15000,""$15,000 -
$15,999"",""$15,000 or below""))))))))"

but in Column A they all give me the result is: $80,000 or above
Even the amount is only 5000

Please Help


Best Regards





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
Wrong code? GBH99 Excel Programming 3 September 12th 07 05:40 PM
Can someone tell me what is wrong with this code? Ant Excel Discussion (Misc queries) 8 November 14th 05 02:53 PM
wrong code? minostrada Excel Programming 6 October 26th 05 02:50 PM
What's wrong with my code ? christophe meresse Excel Worksheet Functions 3 August 2nd 05 05:09 PM
What is wrong with this code? Jan Excel Programming 4 June 14th 05 06:48 PM


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