VBA stopped working, I made no changes...

  • Hello,


    So I am very much a VBA noob, I cobbled something together from snippets and tutorials online and it worked. Very simply it does a lookup in a table to find a value that matches my input, and then copies that row into another sheet. It worked perfectly up until this morning when it suddenly started throwing match errors. I haven't made any changes to it so I am very confused. The code is as follows:



    If anyone has any ideas on what might have gone wrong here I would really appreciate it! Happy to provide more information etc. as needed, wasn't sure how much info to start off with here.
  • Hello and Welcome to the Forum :)


    What is precisely your variable lookupvalue ...?


    Do you know why you are using ActiveWorkbook ... when you are only using one single workbook ...?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • The most likely cause is actual errors in the cells (eg #N/A, #NAME?, #VALUE! etc). Not much else would give you a Type Mismatch on that line.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Thank you all for your input, apologies it took a while to get back to you but this was all done on my work laptop and I wasn't back in until this morning. Using your advice I have now found the issue, someone had slipped in an invalid user number and it had thrown an #N/A error which stopped the whole thing working. I've thrown an IF into that lookup that will filter out potential errors now and that has fixed the issue. Whilst I'm sure the whole thing could be way way smoother it does more or less work at the moment and unfortunately due to it being a police force product I'm unable to upload the file for any more detailed assistance. However it is up and running again so thank you all very much! :)