ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    VBA Hint Needed - Change Way An Existing Project Grabs Data

    Scheduled Pinned Locked Moved IT Discussion
    72 Posts 5 Posters 9.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • garak0410G
      garak0410 @dafyre
      last edited by

      @dafyre said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

      Set sResults = Worksheets("REPORT").Range("W2:W50").Find(strPath)

      If I do that, it does finish the Macro but doesn't do the exact match...guessing now if Set sResults = Worksheets("REPORT").Range("W2:W50").Find(strPath) is what I needed, then I perhaps need a conditional statement now?

      1 Reply Last reply Reply Quote 0
      • garak0410G
        garak0410
        last edited by

        What is interesting about learning while you debug is how lurching it can be...like right now, I don't think we need to key on strPath but insread sJob...sJob is the parsed strPath with just the job number...

        It is declared and used in another area of code and not visible to this function so I need to get around that.

        dafyreD 1 Reply Last reply Reply Quote 0
        • dafyreD
          dafyre @garak0410
          last edited by

          @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

          What is interesting about learning while you debug is how lurching it can be...like right now, I don't think we need to key on strPath but insread sJob...sJob is the parsed strPath with just the job number...

          It is declared and used in another area of code and not visible to this function so I need to get around that.

          Pass in sJob as another parameter to the function?

          1 Reply Last reply Reply Quote 0
          • garak0410G
            garak0410
            last edited by

            When this macro goes to call FindJobDir, it is included in this line with sJob:

            vJobFolders = Split(FindJobDir(strpathtofile & sJob), ",")

            Wonder if I need my little code to be after this line rather than in the function for FindJobDir ?

            dafyreD 1 Reply Last reply Reply Quote 0
            • dafyreD
              dafyre @garak0410
              last edited by

              @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

              When this macro goes to call FindJobDir, it is included in this line with sJob:

              vJobFolders = Split(FindJobDir(strpathtofile & sJob), ",")

              Wonder if I need my little code to be after this line rather than in the function for FindJobDir ?

              Possible. Does vJobFolders return a single folder, an array of folders?

              garak0410G 1 Reply Last reply Reply Quote 0
              • garak0410G
                garak0410 @dafyre
                last edited by

                @dafyre said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                When this macro goes to call FindJobDir, it is included in this line with sJob:

                vJobFolders = Split(FindJobDir(strpathtofile & sJob), ",")

                Wonder if I need my little code to be after this line rather than in the function for FindJobDir ?

                Possible. Does vJobFolders return a single folder, an array of folders?
                When debugging the code step by step

                At one point, vJobFolders does get the value of W2 assigned to it...that is after it is verified that is an existing folder at the network location......SJob equals what is typed into Column W but it still doesn't guarantee it will be at the network location that we are looking for an exact match for...

                So thinking aloud, maybe if sJobs doesn't equal the value of sJob at some point, then it should throw up a message that the job folder doesn't exist. That way, not only will it match exactly, but also alert the user to a possible typo...

                Maybe that is a little simplistic for my neophyte VBA mind...

                garak0410G dafyreD 2 Replies Last reply Reply Quote 0
                • garak0410G
                  garak0410 @garak0410
                  last edited by

                  @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                  @dafyre said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                  @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                  When this macro goes to call FindJobDir, it is included in this line with sJob:

                  vJobFolders = Split(FindJobDir(strpathtofile & sJob), ",")

                  Wonder if I need my little code to be after this line rather than in the function for FindJobDir ?

                  Possible. Does vJobFolders return a single folder, an array of folders?
                  When debugging the code step by step

                  At one point, vJobFolders does get the value of W2 assigned to it...that is after it is verified that is an existing folder at the network location......SJob equals what is typed into Column W but it still doesn't guarantee it will be at the network location that we are looking for an exact match for...

                  So thinking aloud, maybe if sJobs doesn't equal the value of sJob at some point, then it should throw up a message that the job folder doesn't exist. That way, not only will it match exactly, but also alert the user to a possible typo...

                  Maybe that is a little simplistic for my neophyte VBA mind...

                  And interesting...I think I may be getting somewhere but now the dreaded NEXT WITHOUT FOR message. I did next this idea in a FOR statement which reads:

                  For i = 0 To UBound(vJobFolders)

                  Should we do one for sResults?

                  Again, thinking out loud here...

                  1 Reply Last reply Reply Quote 0
                  • dafyreD
                    dafyre @garak0410
                    last edited by

                    @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                    Maybe that is a little simplistic for my neophyte VBA mind...

                    The simpler you can make it, the better off everybody will be, lol.

                    garak0410G 1 Reply Last reply Reply Quote 0
                    • garak0410G
                      garak0410 @dafyre
                      last edited by

                      @dafyre said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                      @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                      Maybe that is a little simplistic for my neophyte VBA mind...

                      The simpler you can make it, the better off everybody will be, lol.

                      I still have a lot to learn, no time to learn it and still be Mr. Jack of All Trades SOLO IT Guy...I've literally poked at this code all week in between day to day and not a lot to show but perhaps closer to the solution.

                      dafyreD 1 Reply Last reply Reply Quote 0
                      • dafyreD
                        dafyre @garak0410
                        last edited by

                        @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                        @dafyre said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                        @garak0410 said in VBA Hint Needed - Change Way An Existing Project Grabs Data:

                        Maybe that is a little simplistic for my neophyte VBA mind...

                        The simpler you can make it, the better off everybody will be, lol.

                        I still have a lot to learn, no time to learn it and still be Mr. Jack of All Trades SOLO IT Guy...I've literally poked at this code all week in between day to day and not a lot to show but perhaps closer to the solution.

                        Hopefully you'll get it! Keep poking at it... just don't miss and accidentally poke the bear with a stick!

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 4 / 4
                        • First post
                          Last post