+ Reply to Thread
Results 1 to 40 of 40

Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

  1. #1
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hey Everyone,

    with this project I was wondering if it is possible to target the cells we make yellow, it would be second macro all it needs to do I copy the content from the specific cells that are yellow. I have a template set up.

    Pretty much it would run the first macro, the people working the report would populate the yellow cells and then they would select a second macro which would create a temp worksheet, populate the required information. this temp sheet would have a button to then send that info to a file on the shared drive.

    on the button click to send it would need to search the file on the shared drive for the last populated row and then past all the new data (not including the header) to the shared file.

    Is this possible?


    Thank for any guidance,

    Fawkes_
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hi Fawkes_

    Is the sub "Expedite" the code you are working with for this? Does what you have work so far?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Also... if you are inserting the new sheet through the code, then it did not exist before, for sure? If it is guaranteed not to exist then I'm not sure you need to first check for the columns on the temp sheet?
    If the above is true, then we also don't really need to set any ranges for the temp sheet (because we know exactly which column number has what heading. I know the main sheet can have varying columns so we used ranges, but it makes little sense if you know for sure which column number has what heading)

  4. #4
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Valid point...

    Yes there will never be a temp sheet for any of the reports this will be used on, so I did not runa check, though a check would make sense and make it so they cant break it. so yes maybe there should be a check.

    The code im working with is the expedite, which works to where we are now.

    I was setting them as ranges because we would be pasting an unknown amount of information, and I wasn't sure which way to go with it.

    I was think that the if interior color was yellow was the first check so I was trying to work from there, but I realized im a bit over my head.

    What do you think would be the best way to do this? also, would I be able to set make the second part possible where they are able to send all of the data on the temp sheet to the WS in a shared folder?

    Thank you again for any input on this project you are a life saver.

    Fawkes_

  5. #5
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Oh I forgot to say that the WS on the shared drive will look just like the one on the temp sheet, layout exactly the same. does that help? or hurt? Im not sure how targeting an external sheet for pasting works.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Making progress, but there is no "Sales Order" heading in the main sheet... so the code does error out right now. Did you mean "SO" or will the main sheet be updated before you start using the code?
    What is the path and filename on the shared drive? What is the name of the worksheet the data needs to be added to?

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Try this for starters, the code checks for an existing temp and renames it if it exists to avoid errors. It adds the button and assigns it the second macro in the post below. It opens the network file, pastes, and saves, then closes it. Note that you have to update the filename as well as the worksheet name for the share.

    Please Login or Register  to view this content.
    In both macros you want to make sure if we use tempWS.Range("A" & Rows.Count).End(xlUp).Row that column A will be one that has data EVERY time, otherwise change the A or we need to adapt to check them all.
    Last edited by Arkadi; 02-13-2017 at 04:13 PM.

  8. #8
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hey Arkadi,

    you are quite amazing as always, the file location would be this "<K:\Material Planning\Forecast Response\MasterExpedite FRT.xlsx>"

    And yes the SO would be sales order.

    Sorry

  9. #9
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I was running into an issue with the Sales order line, I adjusted it to SO, but it is holding on this line

    Please Login or Register  to view this content.
    If I manually format the SO column to numbers with no decimals it runs fine (there will never be decimals in this column ) but if it isn't then if just holds there.

    Also, is there a way to autofit after the data is loaded to the temp sheet?

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    So this line
    Please Login or Register  to view this content.
    Changed to
    Please Login or Register  to view this content.
    and you still had an issue? it worked fine when I tried that...
    My copy thinks it is a date column though?
    Last edited by Arkadi; 02-13-2017 at 04:32 PM.

  11. #11
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I have that modified, seems to work fine now idk. maybe I just needed to clear everything out and try again.

    I noticed this is only populating one row on the temp sheet, though.

    for the test wb I extended to crit window to 24 and it has 4 rows with yellow but the macro is only pulling the last one to the temp ws.

    its like its looping through and not writing them as it finds them and just the final one found.

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Yes... ooops! I forgot a line... in the loop below, I needed to add the red line:

    Please Login or Register  to view this content.
    without that it just kept writing over the first row.

  13. #13
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hey Arkadi,

    Im running into an error on this line, says the "subscript is out of range"? It was working fine on my test sheet, but when I try to use it on any other workbook I get this error.

    Please Login or Register  to view this content.
    It was working fine on the test WB but when I brought it over to a live book I ran the original macro fine, just hits this wall now.

    Thank you again for all the time you have devoted to helping me with this
    Last edited by Fawkes_; 02-13-2017 at 05:42 PM.

  14. #14
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I took the code directly from the workbook and saved it to an XLAM and used the autoopen to load it to the add in tool bar, since doing this the code trips on this workbook. could we use activeworkbook in its place? or something along those lines?

    Im not sure if this would work but I feel bad not trying to contribute lol

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Yes you could definitely try activeworkbook. Even not specifying the workbook at all would put it into the active book since that is the default context.

  16. #16
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    As a small upgrade, when we do the .Find, any match could be set to the range, unless we tell it to match the whole content exaxtly. What I mean is that Find "PO" would for example be a match if the header it finds first is "PO Item" since it contains PO. It is better to specify that the whole cell has to match. Most of the headers we look for are pretty unique, but "SO" in particular has the potential for matches in other columns if the headings ever change.

    So for example:
    Please Login or Register  to view this content.
    would change to:
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Good morning Arkadi,

    how are you doing today? I went through a changed SO to Sales order for the add and the searches to remove the chances of it grabbing the wrong column.

    I was able to change the workbook issue to get it to work without issues.

    I get an overflow on the sales order copy section if the "Sales Order" column on the first sheet is not formatted is there a way for me to format that during the add of the column?
    Last edited by Fawkes_; 02-14-2017 at 10:40 AM.

  18. #18
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    What format should it have?

  19. #19
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    standard SO is seven digits, but some people add the line so it can be either "#######" or "#######-#" I think as long as it is in number with no decimals it will be ok.

    if it is set to number no dec then people can still enter a word into the cell without issue for null or blanks so that should be fine. right?

  20. #20
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Ok, so after if soNum is nothing....... End If (in the original code) put this:

    Please Login or Register  to view this content.
    That will make it a number format, no decimals, and yes text will still be ok to enter

  21. #21
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I am pretty sure everything is all set, thank you agai for all of the help on this project you have been more than amazing my friend.

  22. #22
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hey Arkadi,

    It is still throwing a Run time 91 when it trying to send the sales order number to the sheet even with the number formatting, if I manually do this portion it works, but with the numberformat = "0" I get the same error, also I cannot manually adjust afterward

  23. #23
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    give .numberformat = "@" ? that makes it text

  24. #24
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    If the error happens on the test book, can you send me it again? Maybe I can reproduce the problem and try to solve it...

  25. #25
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I just went with "#######" and limited the input allowed to the seven digit base, works like a charm.

    You sir have been great through this process. Thank you again for everything. I owe you a case or a steak dinner or something lol

  26. #26
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Truth is you probably didn't need to limit the input amount, "#" or "####" might even have done it just to indicate no decimals or commas. But I'm glad you found a solution, well done
    Glad I was of some use to you in this project
    Mmmmmm steak (drool)... lol. Maybe hit the rep button if you want to give something, that and as you have so kindly done, mark the thread as solved, are all the thanks required

  27. #27
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Hey Arkadi, sorry for the delay in getting back to you. got slammed with some other projects. You were extremely useful in this process and I appreciate all of the help more than I can express. I have added rep but it wont let me add again until I rep someone else

  28. #28
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I did have a question, I was trying to get something to work and I was having issues.

    Please Login or Register  to view this content.
    I was wondering if this would work to get the data in a cell and to make sure there is something in the cell for it to use.

    I need to verify the column, take the cell value, and send it into another program grab some data and then compare the return data against an array that will have two options after. the back end side working with the mainframe and pcomm I have covered, but i want to be sure this code will take the value and save it so i can enter it into the mainframe. once it does getting the return data isn't tough and the check should be similar to other things you have taught me so i think i can run that. However getting this value is messing with me i think.

  29. #29
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Fawkes,
    If I understand correctly then what you want is to check for a blank in the cell.... I'm not sure why it isn't working the way you have it unless the code below what you have pasted gives more clues...
    As far as just a tip on tidying code, you could replace:
    Please Login or Register  to view this content.
    with:
    Please Login or Register  to view this content.
    But that is just form, and will not change the functionality.

  30. #30
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    On second thought, the column is set before the "for i" loop? It doesn't make sense to check if it is nothing every time... maybe :
    Please Login or Register  to view this content.

  31. #31
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    I thought it would work ... idk there has to be something stupid im missing.


    Here is the full code, but really its something in there I am missing.

    Please Login or Register  to view this content.
    ignore the nonEcompass part I have it commented out for now, I will tackle that mess soon enough. at the moment im just working to get it to pull the cell and use it to enter into a search that will save a value from inside the mainframe (not coded in yet) but at the moment the code runs through and just does nothing. as if I did something wrong with the loop (the mainframe comms part is incomplete due to me not being able to grab the variable to put in place) I have even put debug.print (custacct) and it wont should the value in the immediate window. so I feel like im missing something smh
    Last edited by Fawkes_; 02-16-2017 at 02:32 PM.

  32. #32
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Have you stepped through the code? Is the problem it runs even when len(custacct) should be 0?

  33. #33
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    it doesn't run after the custacct len, if I take the lauch code after it runs fine, but when I tell it to check if the account number is there and then to run it wont run

    really it should always have an account number but I wanted to build in an idiot proof method.... clearly I am an idiot so its not working

    after this I still have a huge hill to climb, I need to insert a column next to neda and have it auto fill with a vlook to a network file. but i cant figure out how to get it to not use the same formula for each.

    after that there is another hill or two lol, i cnat ever have easy things to make work

  34. #34
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    lol ive forgon the one check and decided to focus on the vlook up and making it work

    however my vlook is just returning false in the cells smh

  35. #35
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Have you made sure it is finding the column? I guess so, since it would give you a message if it is nothing...
    Have you checked what custAcctCol.Column is, and checked it is the right column number? also, have you checked what the value of WS.Cells(i, custAcctCol.Column).Value is when i=2 (or any other number)... I just wonder if custacct is getting the right value.

  36. #36
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Additionally, why are there quotes in this? The variables are double, and that is numerical
    Please Login or Register  to view this content.
    Probably won't matter much since it will take the numerical value, and not the string, but it is technically a contradiction.

  37. #37
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Valid point, It was just a habit I can remove them and it will work as well lol.

    I was trying to check the value with the debud.print but I could get it to spit anything out.

    Currently im working with the vlook and im getting false in everycell. Im pretty sure that is my fault because I used something pretty dumb to do it, I used the same method I would use from a record macro to link the file. so I think I need to use a much different method since im doing it as a loop now.

    Please Login or Register  to view this content.
    the column to left of the vlook is cell for the search so I think I need to use something similar to this

    Please Login or Register  to view this content.

    I decided to give this a shot, but It just displays the entire formula in the cell if I remove formatting, because it defaults to text, if I do numbers it does nothing, how would I properly format the column to take the formula?

    Please Login or Register  to view this content.
    Last edited by Fawkes_; 02-16-2017 at 05:55 PM.

  38. #38
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Figured it out

    Please Login or Register  to view this content.

  39. #39
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Good morning Fawkes
    Sorry I hadn't replied sooner, just came back on... but I'm glad you have sorted out the problem yourself, great job!

  40. #40
    Forum Contributor
    Join Date
    12-16-2016
    Location
    Colorado, US
    MS-Off Ver
    2013
    Posts
    115

    Re: Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.

    Good Morning Arkadi,

    There is never a reason for you to apologize, you have committed more time than anyone could have ever thought someone would. You truly are an amazing teacher for these processes. once I get the rest of these variables in ill post the final code. which was all possible due to your teaching.

    Thank you again

    Fawkes_

+ 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. [SOLVED] help pulling specific data from another sheet
    By ahalliwell in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-28-2016, 10:17 AM
  2. Replies: 1
    Last Post: 12-08-2015, 03:51 AM
  3. Copy specific data from a sheet to temp sheet and copy temp sheet to new workbook
    By ANUARORA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2015, 11:58 AM
  4. how to copy specific data from a sheet to temp sheet and copy temp sheet toa new workbook?
    By NatashaKapoor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2014, 09:01 AM
  5. Code to pulling specific data from a sheet
    By pnaquin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-26-2011, 05:32 PM
  6. Replies: 3
    Last Post: 10-05-2010, 11:19 AM
  7. Pulling data from a sheet into Word in a specific order
    By schallpattern in forum Excel General
    Replies: 0
    Last Post: 06-09-2009, 03:29 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