+ Reply to Thread
Results 1 to 5 of 5

finding string with wildcard in for each loop

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    finding string with wildcard in for each loop

    Hi gurus and experts,

    I have written the following code to find out the specific string "currency" in a workbook controlled by another user.

    Please Login or Register  to view this content.

    However, the string "currency" is sometimes written as "cy", "ccy", or "cncy" by another user. To accommodate all possible 4 cases, I tried to find the cell and its address by using the wildcard "*", however, it did not work. Only the string value with exact match worked.

    The reason I used "For Each" loop is because the user, at times, adds columns on adhoc basis and I cannot specify code to a particular column. The structure of report generally remains same.

    Is there any means to solve this issue? I appreciate for your suggestions.

    Thank you
    Last edited by Roshan.Shakya; 10-28-2020 at 09:18 AM.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: finding string with wildcard in for each loop

    Hi Roshan,

    Couple of questions, what do you want to do with the variables cl_name & rw_name ? Do the cells contain other data or just the currency word ? Also, is there any formulas in those cells ?
    Last edited by nankw83; 10-28-2020 at 09:38 AM. Reason: Removed code, need more info

  3. #3
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: finding string with wildcard in for each loop

    Thank you nankw83 for your queries.

    Once I find the column where the "currency" head is located, I will do similar search for another head "exposure amount" (that will probably be next to the currency column). Since user adds columns for various reconciliation purposes, the only thing that is certain is - currency and it's respective amount will be in the same row.

    The identification of columns enables me to pick the desired (amount) data based on the currency using conditional statements in For loop. The cells containing heads ("currency" and "exposure amount") are value data and do not contain formula while other than that there could be many formulas.

    Thank you

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: finding string with wildcard in for each loop

    Are you trying to locate the currency column?

    If so which row are the headers in?
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: finding string with wildcard in for each loop

    Thank you Norie for your question.

    The rows are also uncertain that is why I am trying to find the row and column address. By the way, I used the following line to resolve the issue:
    Please Login or Register  to view this content.
    I have ruled out searching "cy" for the time being after taking stock of the number of reports.

+ 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. SUM funtion for cells in row containing both string AND with specified month
    By Chairman_Wu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-15-2019, 06:43 PM
  2. Nested For Loop With Step Funtion Not Working
    By cokingtins1 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-05-2017, 04:37 PM
  3. Replies: 2
    Last Post: 08-12-2014, 12:56 PM
  4. Please help-INDEX and finding MAX date of criteria in text string with wildcard
    By GirlAnalyst in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-18-2013, 05:05 PM
  5. Excel macro error 91: while finding a string in wrokbook second time in a loop
    By vivekdevkar in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-02-2010, 05:25 AM
  6. [SOLVED] Wildcard search for string within a string?
    By Ed in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2006, 06:35 PM
  7. If funtion wildcard
    By unodemad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-03-2005, 01:23 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