PC Review


Reply
Thread Tools Rate Thread

.cells reference?

 
 
John
Guest
Posts: n/a
 
      28th Nov 2009
Hi I am trying to find when a value crosses above or below zero in a table
for multiple test objects... my code does not return any crosses... when
column "B" should find one

Sub Scorecross()
Sheets("Scores").Select
lastticker = Range("b2").End(xlToRight).Address
lstcol = Range("b2").End(xlToRight).Column
todayrow = Range("a2").End(xlDown).Row
For Each i In Sheets("Scores").Range("b2", lastticker)
If Cells(i.Column, todayrow) < 0 And Cells(i.Column, todayrow - 1) > 0
Then
nxtwatch = Sheets("watch list").Range("a4000").End(xlUp).Address
Sheets("watch list").Range(nxtwatch).Offset(1, 0) =
Sheets("scores").Cells(i.Column, 2)
Sheets("watch list").Range(nxtwatch).Offset(1, 1) =
Sheets("scores").Cells(i.Column, todayrow)
Sheets("watch list").Range(nxtwatch).Offset(1, 2) = "Cross UP"
Sheets("watch list").Range(nxtwatch).Offset(1, 3) =
Sheets("Scores").Range("a" & todayrow).Value
End If
If Cells(i.Column & todayrow) < 0 And Cells(i.Column & todayrow - 1) < 0
Then
nxtwatch = Sheets("watch list").Range("a4000").End(xlUp).Address
Sheets("watch list").Range(nxtwatch).Offset(1, 0) =
Sheets("scores").Cells(i.Column, 2)
Sheets("watch list").Range(nxtwatch).Offset(1, 1) =
Sheets("scores").Cells(i.Column, todayrow)
Sheets("watch list").Range(nxtwatch).Offset(1, 2) = "Cross DOWN"
Sheets("watch list").Range(nxtwatch).Offset(1, 3) =
Sheets("Scores").Range("a" & todayrow).Value
End If
Next
'Call scoreEmail
Sheets("watch list").Select
End Sub


Thanks for any help!
 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      28th Nov 2009
I had the row and column reversed

"John" wrote:

> Hi I am trying to find when a value crosses above or below zero in a table
> for multiple test objects... my code does not return any crosses... when
> column "B" should find one
>
> Sub Scorecross()
> Sheets("Scores").Select
> lastticker = Range("b2").End(xlToRight).Address
> lstcol = Range("b2").End(xlToRight).Column
> todayrow = Range("a2").End(xlDown).Row
> For Each i In Sheets("Scores").Range("b2", lastticker)
> If Cells(i.Column, todayrow) < 0 And Cells(i.Column, todayrow - 1) > 0
> Then
> nxtwatch = Sheets("watch list").Range("a4000").End(xlUp).Address
> Sheets("watch list").Range(nxtwatch).Offset(1, 0) =
> Sheets("scores").Cells(i.Column, 2)
> Sheets("watch list").Range(nxtwatch).Offset(1, 1) =
> Sheets("scores").Cells(i.Column, todayrow)
> Sheets("watch list").Range(nxtwatch).Offset(1, 2) = "Cross UP"
> Sheets("watch list").Range(nxtwatch).Offset(1, 3) =
> Sheets("Scores").Range("a" & todayrow).Value
> End If
> If Cells(i.Column & todayrow) < 0 And Cells(i.Column & todayrow - 1) < 0
> Then
> nxtwatch = Sheets("watch list").Range("a4000").End(xlUp).Address
> Sheets("watch list").Range(nxtwatch).Offset(1, 0) =
> Sheets("scores").Cells(i.Column, 2)
> Sheets("watch list").Range(nxtwatch).Offset(1, 1) =
> Sheets("scores").Cells(i.Column, todayrow)
> Sheets("watch list").Range(nxtwatch).Offset(1, 2) = "Cross DOWN"
> Sheets("watch list").Range(nxtwatch).Offset(1, 3) =
> Sheets("Scores").Range("a" & todayrow).Value
> End If
> Next
> 'Call scoreEmail
> Sheets("watch list").Select
> End Sub
>
>
> Thanks for any help!

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert cells reference to string reference?? Robert Crandal Microsoft Excel Programming 2 1st Dec 2009 07:46 AM
Formulas that reference cells that reference another cell =?Utf-8?B?QW5kcmVh?= Microsoft Excel Misc 7 19th Oct 2006 08:14 AM
reference format Range(Cells(),Cells()) =?Utf-8?B?U3RlZmk=?= Microsoft Excel Programming 5 16th Dec 2005 02:25 PM
Excel cells can reference other cells to display its contents/any. =?Utf-8?B?NTBndW1ieXM=?= Microsoft Word Document Management 1 9th Feb 2005 10:33 AM
Problem when copying cells that reference other cells =?Utf-8?B?UmljaA==?= Microsoft Excel Misc 2 19th Aug 2004 09:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:03 AM.