View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jayne22 Jayne22 is offline
external usenet poster
 
Posts: 20
Default For...Each loop not working

I'm trying to fill in a formula for each empty cell in Last_Cell (a range
that i declared); if the cell is not empty, it can skip that cell. Why
doesn't this work when there are definitely empty cells in the range?

Dim First_Cell, Last_Cell as Range
For Each First_Cell In Last_Cell
If Last_Cell Is Nothing Then
First_Cell.Activate
ActiveCell.Formula = "=dsum(H15:M2000,m15,ak5:al6)"
Else
Exit For
End If
Next First_Cell

End Sub