+ Reply to Thread
Results 1 to 10 of 10

Help with fixing match problem in code

  1. #1
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Help with fixing match problem in code

    Hi

    I have code that is not writing the expected result and so I could really use some help with making the necessary adjustments. I don’t want to change the code.

    Using the Excel image below the expected written result is the grey highlight in the D5:H17 box area. The data gets written based on any set of numbers in the range E6:E17 and comes from the data source cells M5 to O17. So as an example when cell E8 (3rd line down) has the 10-1 in it the code would search the data source (3rd line down) and write from the data source cells M8/N8/O8 to cells F8/G8/H8. I have also uploaded my Excel workbook.

    Thanks so much for any help.
    Please Login or Register  to view this content.

    WRITE PROBLEM.png
    Attached Files Attached Files

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Help with fixing match problem in code

    Quick question (I don't understand fully this code), if in E8 will be something else than 10-1, do you want to still copy M8:O8 into F8:H8?
    Is it any relation between values in col E or just if it is not empty do copies?
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Help with fixing match problem in code

    Why do you need all that VBA - couldn't you just use some simple formulae?

  4. #4
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Help with fixing match problem in code

    Hi

    Thanks for your replies. To KOKOSEK question on something other than 10-1. It could be any set of numbers 99-8 or whatever is the criteria for the code to write the numbers from the data source. On "relation between values in col E or just if it is not empty do copies? " if the cell range is empty no writing from the data source occurs.

    To StephanR: Need all this VBA because this is just one example of data. When you have maybe a hundred or more in the future it's better to have code. Also other issues.

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Help with fixing match problem in code

    So, if it does not matter what's in E run by this:

    Please Login or Register  to view this content.
    a bit shorter and works

  6. #6
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Help with fixing match problem in code

    I really appreciate your help but as I said in my post I really have to use the posted code. I just have to get it to write to the proper cells. My very small example is just that. My real sheet is massive and I'll have hundreds at these of this. This code will allow me to expand my data boxes.

    Thanks
    Last edited by CHRISTINEKENDALL93; 04-18-2019 at 11:54 AM. Reason: spell

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Help with fixing match problem in code

    I'll try to analyse your code but it is quite hard especially if it does not working.

  8. #8
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Help with fixing match problem in code

    I think it's the match that's the issue.

    Thanks so much

  9. #9
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Help with fixing match problem in code

    I was trying trace variables but:

    that's xtar:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    obviosly gives error because whole col C is empty.

    that's rtar:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    put this formula into cell, giving also error.

    I don't know how you get this code, but sorry I give up.

  10. #10
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Help with fixing match problem in code

    Hi KOKOSEK

    I tried but it didn't work. Thanks so much for your attempt. Please close this posting.

+ 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. Create MsgBox If Cell is already populated
    By MariPip in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2014, 07:27 PM
  2. Matching data between two sheets
    By MariPip in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2014, 06:24 PM
  3. Need HELP fixing this code
    By Dewbo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-29-2014, 09:16 AM
  4. [SOLVED] Fixing the VBA code
    By brownie4321 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2012, 09:35 AM
  5. help fixing a calculation problem
    By barrfly in forum Excel General
    Replies: 3
    Last Post: 11-04-2005, 12:10 PM
  6. fixing problem with my tab
    By Zane in forum Excel General
    Replies: 2
    Last Post: 08-06-2005, 03:05 PM
  7. fixing code
    By timmy64 - ExcelForums.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2005, 04:48 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