+ Reply to Thread
Results 1 to 4 of 4

Modify VBA to also write matching matrix pattern as cell reference name

  1. #1
    Forum Contributor
    Join Date
    11-17-2018
    Location
    Los Angeles
    MS-Off Ver
    Office 2010
    Posts
    208

    Modify VBA to also write matching matrix pattern as cell reference name

    Excel 2010 - Modify VBA to also write matching matrix pattern as cell reference name in column EE

    Can someone lend me a hand with this please?

    Everything works, there is not a single problem. I simply need to add a new output in column EE using the existing VBA macro (add one more thing to do to the existing macro).

    I have a sequence of numbers which are checked against a matrix full of numbers, and if it is a match (per row), then how many of those matrices are matched is recorded in column EA and also which Matrix assigned number was found to match in column EC.

    If you open the attached file, simply click the RED button labeled "AUTO FIND MATCH" and once it is done, scroll to the right all the way to column "EA" and you will see how it records how many grids (there are a total of nine) the sequence of numbers (starting in row/cell C1) did match and in column "EC" it will record the grid assigned number that matched (the grid numbering starts on "BB58").

    Once again, everything works flawlessly, there are no errors.

    What I need now, is that the VBA macro (found in MODULE 1, called "Sub Python3AutoFindPatterns()") that it is being used with the RED button ALSO OUTPUTS per row in column EE which cells (cell reference names) were used to find a match for each row using the grid that start in "BF12" which is labeled "Matrix 2" (Matrix 1 could also be used).

    This Excel file also has code in place to do it manually one by one, one row at a time. So, to illustrate better what I need, using the manual mode, simply click on cell "S1" and it will be marked with a red X (just by simply clicking on cell S1). You will now see numbers inside Matrix 1, and X inside Matrix 2, and they correspond to each other. Scroll down the sheet and you will also see that on cells BU59, BZ59, and CO59 it is displayed "FOUND" and the cells are GREEN. This indicates that three grids (numbers 5, 6, and 9) match with the same number sequence listed in cell C1, D1, and E1.

    What I need is that on cell EE1 (corresponding to the first sequence that starts on C1) the VBA macro outputs the cell names that were used for this matching sequence based on using Matrix 2.

    Of course that if nothing matches (if the outcome is zero) then column EE should have nothing accordingly. It will be blank.

    Here is an example of the outcome I need (doing it manually):
    -Click once on cell S1 and the grid called Matrix 1 shows numbers, and Matrix 2 show X.
    -Since this sequence is found to match (see range BA59:CO59), then using Matrix 2, the output in column EE1 should be: BH14, BF15, BI15 (indicating that those cells were the ones with the X in Matrix 2, for row one).
    -The same should be for row C2. Cell EE2 should list (separated by commas) the cell names used if the grid does match, etc.

    Doing it manually will not record the needed output in column EE. Only by using the RED button the VBA macro should output the desired cell reference in column EE. I need this new output only when using the RED button, not when doing it manually.

    I thought of adding an IF-THEN-ELSE to the macro but I have not been able to make it work (for example using Matrix 2:
    Please Login or Register  to view this content.
    but I have not been able to correctly concatenate the IF for all 28 cells of the grid and to list the output separated by commas in column EE (BH14, BF15, BI15).

    When using the red "AUTO FIND MATCH" button (linked to the macro in Module 1 called "Sub Python3AutoFindPatterns()"), the desired output in column EE should be:

    In cell EA1: 3
    In cell EC1: 5, 6, 9,
    In cell EE1: BH14, BF15, BI15

    In cell EA2: 3
    In cell EC2: 5, 6, 9,
    In cell EE2: BF13, BI13, BH14

    In cell EA3: 3
    In cell EC3: 5, 6, 9,
    In cell EE3: BG12, BH12, BH14

    etc...

    In cell EA17: 3
    In cell EC17: 5, 6, 9,
    In cell EE17: BH12, GB16

    In cell EA18: 2
    In cell EC18: 2, 5,
    In cell EE18: BF13, BG15

    etc.


    Here is the macro I need to modify:

    Please Login or Register  to view this content.


    I hope I make sense. If not, I apologize.

    In advanced, a billion thanks for any help given.
    Last edited by Luisftv; 03-27-2024 at 05:01 AM.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Modify VBA to also write matching matrix pattern as cell reference name

    Does this work for you?


    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-17-2018
    Location
    Los Angeles
    MS-Off Ver
    Office 2010
    Posts
    208

    Re: Modify VBA to also write matching matrix pattern as cell reference name

    ByteMarks,

    It works flawlessly exactly as needed. THANK YOU.

    Have a wonderful day.

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Modify VBA to also write matching matrix pattern as cell reference name

    Great. Thanks for the feedback.

+ 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. Regex: Matching pattern to split a cell data
    By DavidRoger in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-01-2014, 07:31 AM
  2. Matching State City Zip Code Pattern before transposing to corresponding cell
    By sandy1977 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-29-2014, 10:37 PM
  3. Copy down hypertext cell range pattern & cell reference formula pattern
    By Underexcelling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2014, 03:23 AM
  4. [SOLVED] Globally modify non-adjacent worksheet formulas matching a pattern
    By tlafferty in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2012, 02:42 PM
  5. Macro for pattern matching a string in a cell
    By gravel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2011, 05:33 PM
  6. Replies: 3
    Last Post: 03-31-2007, 07:01 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