ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Replacement (https://www.excelbanter.com/excel-discussion-misc-queries/44273-re-replacement.html)

mowen

Replacement
 

Hi

I want to replace NameY (fixed) with NameX, but name X change for every
sheet. So my intetion is to relate it to the contain in cell J2 that is
different at different sheet.

I have this code now but as I have told you i want to relate it to the
contain in cell J2.

Sub ReplaceName()
'

Cells.Replace What:="NameY", *Replacement:="NameX", *
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False
End Sub

Thanks

Rune


--
mowen
------------------------------------------------------------------------
mowen's Profile: http://www.excelforum.com/member.php...fo&userid=8463
View this thread: http://www.excelforum.com/showthread...hreadid=465486


[email protected]

Try this:
Replacement:=Range("j2").Value
....between your stars, but remove the stars to run the code, of course.



All times are GMT +1. The time now is 04:28 AM.

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