View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Pointless Pointless is offline
external usenet poster
 
Posts: 1
Default Copy value until next value


I don understand how you are setting RNG. But once that is done yo
could just as well use good old fassion Offset(-1, 0).Value

For Each CELL In RNG
If CELL.Value = "" Then CELL.Value = CELL.Offset(-1, 0).Value
Next

Or something like:

Sub Month_copy()

Dim CURRPERIOD As String
Dim CELL As Range, StartCell As Range, RNG As Range
With ActiveSheet
If IsEmpty(.Range("A1")) Then
Set StartCell = .Range("A1").End(xlDown)
Else
Set StartCell = .Range("A1")
End If
Set RNG = .Range(StartCell, .Range("A10000").End(xlUp))
End With
'MsgBox (RNG.Address)

For Each CELL In RNG
If CELL.Value = "" Then CELL.Value = CELL.Offset(-1, 0).Value
Next

End Su

--
Pointles
-----------------------------------------------------------------------
Pointless's Profile: http://www.excelforum.com/member.php...fo&userid=3086
View this thread: http://www.excelforum.com/showthread.php?threadid=50679