View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
kittronald kittronald is offline
external usenet poster
 
Posts: 162
Default Searching for text within formula

Isabelle,

I added two names to the macro.


Sub Macro1()
x = Sheets("Sheet1").Range("First_Cell").Formula
y = Application.Substitute(x,
Sheets("Sheet1").Range("Current_Function"),
Sheets("Sheet1").Range("Selected_Function"))
Sheets("Sheet1").Range("First_Cell").Formula = y
End Sub


The name "Current_Function" comes from using the SEARCH function to
find the current function in "First_Cell".

The name "Selected_Function" changes based on selecting a value
from a ComboBox.

It works, but for brevity, do I really need to write
"Sheets("Sheet1").Range("NAME") for each argument ?


- Ronald K.