Can I use the REPLACE function with a variable value for position?
What I vant to do is this
DIM mvar1 As long
Mvar1=(LEN(B1)-9)
REPLACE(b1,& mvar1, 1,”,”)
But can't seem to get the syntax sorted.
Any suggestions?
Can I use the REPLACE function with a variable value for position?
What I vant to do is this
DIM mvar1 As long
Mvar1=(LEN(B1)-9)
REPLACE(b1,& mvar1, 1,”,”)
But can't seem to get the syntax sorted.
Any suggestions?
https://docs.microsoft.com/en-us/off...place-function
Replace(expression, find, replace, [ start, [ count, [ compare ]]])
The Replace function syntax has these named arguments:
Part Description expression Required. String expression containing substring to replace. find Required. Substring being searched for. replace Required. Replacement substring. start Optional. Start position for the substring of expression to be searched and returned. If omitted, 1 is assumed. count Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means, make all possible substitutions. compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.
So in ...
REPLACE(b1,& mvar1, 1,”,”)
... you might want ....
Actually, I can't guess as to what you want. Might be best to add an example
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
PHP Code:
Replace([B1], "1", "," ,len([B1])-9)