+ Reply to Thread
Results 1 to 5 of 5

Specify a string within a replace function

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Specify a string within a replace function

    Hi all,

    How can I specify the string "StoreType" within my find/replace code? I want to have Excel take the selected name from the specified range and put in in my replace code. Currently it only inserts "StoreType" instead of the value (name) in Range("Selected_StoreType")... Am I defining my variable wrong?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,432

    Re: Specify a string within a replace function

    Try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Specify a string within a replace function

    Thanks!! It does what I asked for, but it does not 100% solve the problem (yet). Now it inputs the selected store type from the cell, e.g LARGE(IF((Region=FSS) though, the formula only works with quotation marks LARGE(IF((Region="FSS") Unfortunately when I put "" before and after the string, it doesn't seem to work...?

    Also, is there a way to get the store type directly from the list.index from the form control? something like the below?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,432

    Re: Specify a string within a replace function

    Oops, try:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Specify a string within a replace function

    That works smoothly!! Thanks!

    Do you also happen to know how to get the value/name directly from the form control list.Index, rather than from a cell?

    Please Login or Register  to view this content.
    Something like the above?

+ 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. [SOLVED] vba Replace function not finding string
    By noblerot in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2020, 06:29 PM
  2. Function or Formula to replace a dynamic string with a NULL value
    By sryme in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-31-2016, 11:23 AM
  3. Replies: 1
    Last Post: 07-03-2014, 04:32 AM
  4. [SOLVED] Need help with REPLACE function to replace HEX A0 with HEX 20 in string
    By flyboy54 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2013, 12:52 PM
  5. Replace variables in string and perform function
    By Jefferson in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-02-2012, 07:53 PM
  6. Replies: 15
    Last Post: 07-05-2012, 12:49 PM
  7. Instr Function - Replace String 2 with Variables?
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-08-2010, 03:14 PM

Tags for this Thread

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