Help with intersect

  • [xpost]


    Hello, I am attaching my code with which I have a problem.

    My problem is that with this code I open 2 files (and so far so good), when I insert the value "UT-E" in the source file, the various values are copied in a table in the second sheet.

    The problem is that whatever I write in the "SOP" column after entering the letter, number or other, the code switches to displaying the second excel file. I, on the other hand, would like it to pass to the second worksheet only if I enter the word "UT-E"

    I am attaching the 2 files ...... do not make fun of me .... it is trivial and maybe even long and incorrect

  • Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the URL from the address bar in your browser) to the cross-post. We are here to help so help us help you!

    Read this to understand why we ask you to do this

  • It's hard to test your code and replicate the error because you have hard coded a path into the code.

    You might try changing the Intersect code to this

    If Not Application.Intersect(Target, origintbl.ListColumns("SOP").DataBodyRange) Is Nothing Then
            For Each xCell In Rg
                If xCell.Value = "UT-E" Then

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!