View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Replace() Range Function

Of course, that code requires an "End With" toward the bottom....

For J = 1 To 12
With oRange.Cells(J, 1)
If .Value < "" Then
objOther.Replace .Value, .Offset(0,1).Value
End If
End With
Next

Sorry about that,
Bernie
MS Excel MVP

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Anyway, the upshot of the above is that you could try changing your code

to:

Dim oRange As Range
Set objOther = sht2.Range("A4:H850")
Set oRange = shtTotals.Cells(8, 1)

For J = 1 To 12
With oRange.Cells(J, 1)
If .Value < "" Then
objOther.Replace .Value, .Offset(0,1).Value
End If
Next