View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SangelNet SangelNet is offline
external usenet poster
 
Posts: 31
Default compare two cells

seeking help on how to compare cell in two columns and get a message
if one is empty.

i have column T and U and would like to get a message if cell t1 has
something and cell u1 has nothing. if cell in column t have nothing
just exit the sub. if T has something and u has something just exit
the sub. just message when t has something and u does not.

i tries looking up something and nothing fits that need.

tried to cook up my own, but does not work. here is what i got

Sub compare()

Dim T As Range 'column T
Dim U As Range 'column U
Dim c As Range

Set T = Range("T")
Set U = Range("U")

For Each c In T

If T.Cells.Value = "" Then 'If T is empty the leave
Exit Sub
Else

If T.Cells = 1 And U.Cells = 1 Then '1 as in something 0
as in nothing
Exit Sub
Else
If T.Cells = 1 And U.Cells = 0 Then '1 as in something 0
as in nothing
MsgBox ("my message here")
End If
End If
End If

Next c

End Sub

any help ? thnx