View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default How to add "'" into string?

On Sat, 10 Apr 2010 04:57:01 -0700, Eric
wrote:

Within macro, I would like to replace "1'" with varable + "', there is an
error.
Please see the following code for details

Cells.Replace What:="1'", Replacement:=Range("A2").Value&"'",
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False

Does anyone have any suggestions on how to solve this coding?
Thanks in advance for any suggestions
Eric


It's always helpful if you post the error text, instead of making us guess.

If you are getting a compile error, it might be due to having omitted the
spaces before and after the ampersand in your Replacement:= string.
--ron