Thread: For each next
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default For each next

Hi Kaval,

Sub TestIt2()
Dim rCell As Range
Dim rng As Range

Set rng = Range("A1:A10")

For Each rCell In rng
With rCell
If IsNumeric(.Value) Then
.Value = .Value * 2
End If
End With
Next rCell

End Sub


---
Regards,
Norman



"Kaval" wrote in message
...
I have a macro that cycles through each cell in a range, eg

for each CELL in RANGE

This seems to work OK until I include something in the code that changes
the
value of CELL, and then the macro just ends at that point.

I have tried declaring CELL as a range but no success.

Any clues as to why this might happen?

Regards, Kaval