ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Cell.Replace (https://www.excelbanter.com/excel-programming/441689-using-cell-replace.html)

ordnance1[_2_]

Using Cell.Replace
 
Is there any way to make the What:="" be a variable? So if the variable =
Test then the replace code would look for Test.



Cells.Replace What:="", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


JLGWhiz[_2_]

Using Cell.Replace
 
x = Test
sh.Cells.Replace(What:=x,....

Don't use quote marks on variables.

"ordnance1" wrote in message
...
Is there any way to make the What:="" be a variable? So if the variable =
Test then the replace code would look for Test.



Cells.Replace What:="", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False





All times are GMT +1. The time now is 07:24 PM.

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