+ Reply to Thread
Results 1 to 11 of 11

Request for help with VBA Like Function

  1. #1
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Request for help with VBA Like Function

    I have written a bunch of VBA that works just fine. But the Like function is just messing with my mind. This is the relevant portion of my subroutine:

    Please Login or Register  to view this content.
    I have used Debug.Print to check that TempArray(0) and TempArray(1) are pulling "Hello " and " Goodbye" respectively, so I really don't know what I'm doing wrong.

    The only thing that I'm not including in the above is that the SourceString is actually ThisWorkbook.Worksheets(1).Cells(1, 1).Value only with different numbers. I do a Debug.Print of that Value before I test to make sure I'm looking at the right information.
    Last edited by dhunton; 05-03-2016 at 09:24 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Request for help with VBA Like Function

    Hello dhunton,

    Welcome to the forum.

    ...This is the relevant portion of my subroutine:
    And that would be a problem for most of our esteemed Forum Members.

    Could you please provide us with more info, or better yet, attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Regards.
    Last edited by Winon; 05-03-2016 at 09:00 PM. Reason: text
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Request for help with VBA Like Function

    I get Found equals True. What's the issue? What do you want it to do?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Re: Request for help with VBA Like Function

    Quote Originally Posted by AlphaFrog View Post
    I get Found equals True. What's the issue? What do you want it to do?
    I never get that. Running line by line, it jumps right from the If line to the End If line without running the Found = True line.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Request for help with VBA Like Function

    Quote Originally Posted by dhunton View Post
    I never get that. Running line by line, it jumps right from the If line to the End If line without running the Found = True line.
    I tested using your copied code with no changes. Are you using your TestString in code above or a cell value?

  6. #6
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Re: Request for help with VBA Like Function

    You're right. Mine had some additional text in the SourceString before the first word in the TestString. If you make the following change, you won't get a True result, either. And I need it to return True for something like this.

    SourceString = "I said Hello then said Goodbye to her"

  7. #7
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Re: Request for help with VBA Like Function

    Dang... problem is it's case sensitive... I was lazy on my own test and didn't capitalize.

    Is there any way to make "like" be NOT case sensitive?

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Request for help with VBA Like Function

    Quote Originally Posted by dhunton View Post
    Is there any way to make "like" be NOT case sensitive?
    Try add one line on the top of the module (out side any procedure)
    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Request for help with VBA Like Function

    Quote Originally Posted by dhunton View Post
    Dang... problem is it's case sensitive... I was lazy on my own test and didn't capitalize.

    Is there any way to make "like" be NOT case sensitive?
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Re: Request for help with VBA Like Function

    Quote Originally Posted by jindon View Post
    Try add one line on the top of the module (out side any procedure)
    Please Login or Register  to view this content.
    Would this affect any numeric comparisons? When I glanced at it, it seemed like it would, so I didn't look further.

  11. #11
    Registered User
    Join Date
    05-02-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    35

    Re: Request for help with VBA Like Function

    Quote Originally Posted by AlphaFrog View Post
    Please Login or Register  to view this content.
    That works perfectly for what I need! Thank you!

+ 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. Wait for winhttp request to be done (much like XML http request)
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-23-2015, 09:26 AM
  2. [SOLVED] [urgent] request for drop list function
    By ikhtiar82 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-17-2015, 05:36 AM
  3. request for help for a simple calendar function
    By John Amaral in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-19-2013, 07:06 PM
  4. request how derivative of function in vba?
    By hamidciv in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2012, 04:55 PM
  5. If Function Adjustment Request.
    By SVTF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2011, 10:17 AM
  6. Advanced Function Help Request
    By Rocc0 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-09-2008, 04:07 PM
  7. [SOLVED] where to get: XLODBC.XLA (SQL.REQUEST FUNCTION PROGRAM ADD-IN)
    By Didier Wiroth in forum Excel General
    Replies: 1
    Last Post: 04-04-2005, 10:06 AM

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