View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Sandy Sandy is offline
external usenet poster
 
Posts: 355
Default Variable in a Search and Replace macro


Hi Bob -

I only need to update part of the variable in the macro....

This is the folumla I need to update in Col D:
=IF(ISBLANK(G9)," ",IF(AND(B9<max53,B9=min53),"pass","Fail"))

This is the full macro:

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.Next.Select

ActiveSheet.Unprotect
Columns("D:D").Select

Selection.Replace What:="min1", Replacement:="min54",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="max1", Replacement:="max54", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("g9").Select


Each time I go to the next worksheet, I need to update the named cell that
is called up in the formula -- ie "min54" becomes "min55"