+ Reply to Thread
Results 1 to 4 of 4

Save substring wrapped around delimited notations

  1. #1
    Registered User
    Join Date
    11-12-2018
    Location
    Norway
    MS-Off Ver
    Excel
    Posts
    2

    Save substring wrapped around delimited notations

    Let's say that I have a string:

    StringOriginal = "I want to go to %Paris% and have a %lunch%"

    I want to be able to save the substrings wrapped aroung '%' as unique variables so that I also have:

    StringB = "Paris"
    StringC = "lunch"

    Does anyone know how I can manage to fix this?

  2. #2
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Save substring wrapped around delimited notations

    does this help?

    Please Login or Register  to view this content.
    Last edited by dmcgov; 02-14-2019 at 07:32 AM. Reason: changed the var from long to string

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Save substring wrapped around delimited notations

    so i don't think that there is a way to dynamically dimension variables but i did find a way by using a dictionary approach. see the following code:

    Please Login or Register  to view this content.
    then you cans say something like: if str_var("StringA") = "Paris" then msgbox "Found var"

    is this something that you can work with?

  4. #4
    Registered User
    Join Date
    11-12-2018
    Location
    Norway
    MS-Off Ver
    Excel
    Posts
    2

    Re: Save substring wrapped around delimited notations

    This one worked perfectly! I just had to add a dictionary in order to save the variables. What I need next is a way to combine the dynamic variables into a new variable where the length depends on the number of dynamic variables.

    Let's say that I have now have have i numbers of dynamic variables, and I want to create a string that consists of these variables:

    stringEnd = dynVariable(1) & dynVariable(2) & ... & dynVariable(i)

    If I have two dynamic variables like below I want to end up with:

    stringEnd = dynVariable(1) & dynVariable(2)

    However, if I have four dynamic variables, I want to end up with:

    stringEnd = dynVariable(1) & dynVariable(2) & dynVariable(3) & dynVariable(4)

    etc.. Anyone who knows how I can work this out?

    Please Login or Register  to view this content.
    Last edited by frkrfjrf; 02-26-2019 at 06:48 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to search cells for substring and replace contents of cell if substring is found
    By robbyvegas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2015, 06:40 AM
  2. how to get the chess notations in columns?
    By sumesh56 in forum Excel General
    Replies: 38
    Last Post: 05-01-2014, 07:53 AM
  3. Search substring within range, report the substring found
    By Brooke1578 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2012, 03:56 PM
  4. Excel formula grammer in BNF or other notations
    By Ramesh561 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2012, 02:15 PM
  5. [SOLVED] Extract Substring, then Ignore that Substring, while collecting data from Other substrings
    By Sameki121 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2012, 05:21 PM
  6. Excel 2007 : Save as x Delimited
    By forJAT in forum Excel General
    Replies: 2
    Last Post: 09-30-2009, 06:09 PM
  7. Substring of a Chr(10) delimited cell
    By peacelittleone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2005, 03:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1