LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Replace text with variable using VBA replace code?

I'm trying to use the formula below to replace the text in a formula
with the info from a variable.

Dim strg As String
strg = Range("D4").Text
Range("C7").Select
ActiveCell.Replace What:="Master Sample Data Form", Replacement:= _
"& strg &", LookAt:=xlPart, SearchOrder:=xlByColumns,
MatchCase:= _
False, SearchFormat:=False, ReplaceFormat:=False

In short it doesn't work, it places & strg & in the formual instead of
the variable information. I've also tried "strg" and strg (without
quotes) and non work. Does any one know how you might be able to
replace text in a formula with variable information?

Thanks!

Mike,

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
3 variable find and replace ncspndoc Excel Discussion (Misc queries) 4 June 30th 06 09:07 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Replace variable row number in formulas Ldub Excel Discussion (Misc queries) 0 November 3rd 05 10:25 PM
Replace worksheet name with a variable monika Excel Programming 3 February 11th 04 03:35 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"