View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
laszlo laszlo is offline
external usenet poster
 
Posts: 3
Default return multiple cell references

Thank you so much! I added this to my existing (& very elementary) macro and
it worked out great. One thing though... what can I do if none of the rows
have errors? If there a way to have no message?

"Gary''s Student" wrote:

For a single line summary, run this macro:

Sub laszlo()
Dim n As Long, m As Integer
Dim bv As Integer, cv As Integer
n = Cells(Rows.Count, "A").End(xlUp).Row
messagee = "The following rows have errors: "
For i = 1 To n
bv = Cells(i, "B").Value
cv = Cells(i, "C").Value
If cv 0 And bv < cv Then
messagee = messagee & i & ", "
End If
Next
Range("D1").Value = Left(messagee, Len(messagee) - 2)
End Sub

--
Gary''s Student - gsnu200742


"laszlo" wrote:

My sheet could have anywhere from 1 to 200 rows.

A B C
1 Jones 9 8
2 Smith 3
3 Jones 6 6
4 Clark 4 3
5 Young 1 1

There's alot of other data in numerous sheets which gets summarized on one
sheet. From this sheet I need to find the row numbers is C0 and B<C. The
problem is I need a one line answer for the summary sheet (ex - The following
rows have errors: 1, 4). Is there anyway to do this? Due to the way my data
is compiled, I am unable to use Data Validation.

Thanks!