ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace misc character with previous sheet name (https://www.excelbanter.com/excel-programming/367667-replace-misc-character-previous-sheet-name.html)

[email protected]

Replace misc character with previous sheet name
 
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


Tom Ogilvy

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




All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com