View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Replace misc character with previous sheet name

Application.Caller would probably indicate you are doing this from a User
Defined Function used in a worksheet. If so, a function used that way is not
permitted to make changes to the worksheet except to return a value to the
cell in which it is located.

--
Regards,
Tom Ogilvy


" wrote:

Hi,

I want to replace the # character with ='previoussheetname'!

so #D55 becomes ='PreviousSheet'!D55

Does anyone know how (if) I can make this work?

Cells.Replace What:="#",
Replacement:="='"&Application.Caller.Worksheet.Pre vious.Name&"'!",
LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False


Thanks!
Helen