View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default How to write a for loop to get the range between a ,b columns


I'm not clear what you're trying to achieve here. Do you just want to see
where items in column A don't match the item in the same row in column B?
why were you using the SUM function in column C?

for checking mismatches try this:-

With Range(Range("B3"), Range("B3").End(xlDown)).Offset(, 1)
.FormulaR1C1 = "=IF(RC1<RC2,""MISMATCH"","""")"
End With

"tom" wrote in message
...
Dim x,y As Integer

NumRows = Range("B3", Range("B3").End(xlDown)).Rows.Count

Range("C2").Select


For x = 1 To NumRows

For y= cells(A).value to cells(B).value
'which code we have to write for comparing a1,b1 are equal or not
ActiveCell.FormulaR1C1 = "=Sum(RC[-1]+1)"

ActiveCell.Offset(x, 0).FillDown
Next
Next