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: 553
Default Passing multiple strings to variable in Replace Function

I am trying to remove the operators and funtions from a formula string. I am
using the Replace Method. However I cannot seem to pass multiple items to
two variables and then have those variables work properly within the two
Replace functions. The goal being to start with a string that looks like
this:

"=$A7+$B$11+SUM($I$2:$I$6)+I6+CHOOSE(1,3,3,$I$6,K$ 3)"

and end up looking like this:

"=$A7 $B$11 $I$2:$I$6 I6 1,3,3,$I$6,K$3 "

Can anyone provide me with some guidance.

Thanks

EM

Sub FormulaZapper()
Dim CurrentFormula As String
Dim CurrentFormulaNoOperators As String
Dim CurrentFormulaNoFunction As String
Dim Operators As String
Dim AllFunctions

AllFunctions = Array("SUM", "CHOOSE")

Operators = "=" & "/" & "+" & "-" & "*" & "^" & & "(" & ")"

CurrentFormula = "=$A7+$B$11+SUM($I$2:$I$6)+I6+CHOOSE(1,3,3,$I$6,K$ 3)"

CurrentFormulaNoOperators = Replace(CurrentFormula, Operators, "")
CurrentFormulaNoFunction = Replace(CurrentFormula, AllFunctions, "")

End Sub
 
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
Passing a function from VB with text strings in quotation marks Max Excel Programming 4 January 13th 06 02:01 PM
passing multiple strings to a function Tijmen Excel Programming 3 October 26th 05 10:38 PM
Batch Replace function for Large strings R Avery[_2_] Excel Programming 4 March 28th 05 10:18 PM
Passing array of strings from DLL function to VBA Jag Man Excel Programming 0 January 12th 04 10:09 PM
passing a variable as an argument to a function Drew[_6_] Excel Programming 3 July 25th 03 08:51 PM


All times are GMT +1. The time now is 09:41 AM.

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"