+ Reply to Thread
Results 1 to 5 of 5

"Like" operator: how to put in bold matching characters?

  1. #1
    Registered User
    Join Date
    08-11-2007
    Posts
    44

    "Like" operator: how to put in bold matching characters?

    Hello, I could improve one of my Excel applications if I was able to display in bold the characters that caused a match in a "Like" expression.

    For example, let us assume:

    t1 = "Excel Forum"
    t2 = "?x*l*"

    We have (t1 Like t2) = True.
    I would like to be able to display why the match occured.
    In the example above, it would be enough if I could display something like "Excel Forum" where I used bold red characters to indicate the match.

    Two task are needed to perform that:

    1) finding the characters responsible for the task
    2) displaying the string correctly

    The second task might be difficult if the result would be returned by a UDF.
    The first task is my main question.
    Last edited by lalbatros; 08-11-2007 at 05:16 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    How are you using the like operator? In a UDF? Are t1 and t2 variables? or Ranges?

    How / where would you like to display the "formatted" output?

    rylo

  3. #3
    Registered User
    Join Date
    08-11-2007
    Posts
    44
    rylo,

    For the moment the "Like" operator is used within the VBA code to perform some calculations according to the wildcards provided by the end-user.

    The application I have in mind here make an abundant use of wildcards to express constraints in an optimisation program. Currently the most frequent use of this applcation involves nearly 500 wildcard expression, most being as simple as "plant*" but some being more involved like "plant.dryer*.*.solidfuel.*". This program is extremely powerful thanks to the use of wildcards, but suffers from a sharp learning curve. Till today, I did most of the customizations by myself and the end-users are reluctant to express themselves their constraints.

    As a first step to make thinks easier for the end-users, I would like to design a tool that guides them to build a wildcard expression. This tool would provide them a feedback by showing them what will be included in the calculation when they use the wildcard they have written. It would be quite useful to make it clear why these item will be included. This explains my question: how could I show why an item will match a wildcard expression.

    Finally, let me add that I have created an extension to the like operator (a function 'myLikeOperator"). Therefore, I will need to extend also the solution I am seeking here.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    I'm sorry but you aren't going to be able to do this with a UDF.

    UDF return values, they don't alter cells or their formats.

  5. #5
    Registered User
    Join Date
    08-11-2007
    Posts
    44
    I agree with you, Norie:

    I'm sorry but you aren't going to be able to do this with a UDF.
    UDF return values, they don't alter cells or their formats.
    That was not my intention to create a UDF for that.
    My intention is to provide a kind of toolbar with a listbox where the possible Like-match are listed and made clear. This toolbar could be made visible when the user wants this help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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