Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Help ... what wrong with this code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuong Nguyen - 14 May 2008 19:09 GMT
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
JLGWhiz - 14 May 2008 21:10 GMT
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.

> Column N is value - Column A is the result
>
[quoted text clipped - 14 lines]
>
> Best Regards
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.