MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Conditional formula change-revisited


Posted by Jim on April 11, 2001 10:29 AM

I should have indicated that the cell references in my example are relative. How would the code be changed to maintain relativity?

THANKS for all the help provided on this forum!

or
If ActiveCell.Offset(-12, 0).Formula = "=A28*6.24" Then
ActiveCell.Replace What:="6.16", Replacement:="6.24"
End If
End Sub


Posted by Dave Hawley on April 11, 2001 10:39 AM

Hi again jim, how about this:


Sub TryThis()
Dim AboveCell As String
AboveCell = ActiveCell.Offset(-12, -1).Address _
(Rowabsolute:=False, ColumnAbsolute:=False)
If ActiveCell.Offset(-12, 0).Formula = "=" & AboveCell & "*6.24" Then
ActiveCell.Replace What:="6.16", Replacement:="6.24"
End If
End Sub

Dave


OzGrid Business Applications