+ Reply to Thread
Results 1 to 18 of 18

Export to new worksheet

  1. #1
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Export to new worksheet

    Hi guys,

    This is the first time I have been asked to dig this far into excel, and to do what I need I will have to use VB or Macros which I am entirely new with. I have used VB a little in the past and understand the language, but never programmed for excel at all. So thank you in advance for any help you can provide me with.

    Here is the situation. I have a Workbook that a client sends us semi-monthly for invoicing information. The workbook consist of a cover page worksheet which is a breakdown of the past half month 14-16 days, which is what the remainder of the worksheets in the workbook consist of.

    This workbook is actually an invoice for all the properties we have inspected, but the problem is we pay them off to each inspector, where the customer sends it in simply by the property and associated information, i.e. work order number, owner, address etc.

    What I need to do is have a way to search the entire workbook, not just one work sheet, by the zip code. I want to sort by the zip codes which is column "Q" and then somehow cross reference it with the inspector's associated to that zip code. This is where my problem lies. I have inspector A and he is assigned zip code 1,2,3,4, and 5 I want to be able to have those zip codes associated with that inspector even though that information is not included in the workbook. If I have to manually add that information into the workbook that is fine.

    Than once the workbook is sorted by inspector I would like to export to individual spreadsheets for each inspector showing every property they have inspected for that period.

    I have found some macros to sort and export that seem like they might work for my needs. My main issue is with adding the association with inspector to the zip codes because that information is not there. So any pointer into tying these processes together would be greatly appreciated.

    Thanks,
    Dave

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    If you put together a table in a worksheet that contain one column for zip code and antoerh for inspector, then you could use the VLookup function to add the inspectors' names to the data worksheets. For example, say you put the table in Sheet1!A:B (zip code first, inspector name second), then the following formula would place the inspectors' names in the cells of column Q. For example, the formula for row 2 would be
    Please Login or Register  to view this content.
    That would get your inspector names into the data sheets so you can sort on them.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

  3. #3
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    Alright that worked Great for adding the names!

    What option can I use to have that vlookup go through the other worksheets in the workbook? I was dabbling around with the indirect() option as I heard this is what I would need, but no luck as of yet.

    I think the biggest issue is that it's a workbook. All the sheets 1-14, 1-15, or 1-16 depending on the month, can all be on one worksheet. That is how I tested you vlookup method by placing everyday on one larger sheet.

    So maybe instead of trying to dig into a workbook I will just combine all the worksheets first, add the lookup, and then split them based on contractor.

    What is the best way to combine a workbook into one worksheet?

    Waht is th ebest way to break one worksheet into multiple seperate sheets by value "contractor name" ?

  4. #4
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    BTW, welcome to the forum!

    Without seeing an example of what you have, I poking around in the dark at bit, but it appears that you need to get the vlookup onto every row in several worksheets. If that is the case, then a macro will do the trick. Since combining worksheets and spliting them up again also takes a macro, then maybe pursuing the first path would be better.

    If you give the some rule about which worksheets need to have the formula added and which column it need to go into (looks like Q), I can help you get that macro together.

  5. #5
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    Alright Well to make it simple I would like to first combine all the worksheets that are the same.

    The workbook consist of 17 sheets max. The first page is for the monthly summary pages and the rest are as follows
    "They are semi-monthly so each workbook is half the months report"
    Sheets 2-15 "28 days february "
    Sheets 2-16 "any 30 day month" or
    Sheets2-17 "any month with 31 days"

    These sheets are all the exact same format having colums ranging from A-V

    I placed the Vlookup in column W and the reference table is in Y & Z

    So before I even add the Vlookup I would like to combine these common sheets into one sheet.

    Than add the vlookup to the one large sheet

    Than split the sheet into seperate sheets based on the new output from vlookup in coloumn W "Inspector"

    And thank you so much for your help. I have learned more about the capabilities of excel over the past week than I ever thought possible.

  6. #6
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    We are getting closer to me understanding this. I think there is only one reference table needed. If you put it in its own worksheet then, there is no need for the duplication that you mention. Is it possible to put it on the summary sheet somewhere so it can be referenced by all other worksheets?

    So the final result will be a workbook that contains as many worksheets as there are inspectors. Is that right? If so, then this might be approached differently. How about this approach? This assumes that the refernce table is located in the workbook somewhere and that you want to create a new workbook without destroying the old one. We will need to rethink how the summary sheet is handled.

    1. create a new workbook
    2. create a worksheet in the new workbook for each inspector in the reference table. These could be named after the inspector. Create a "trash" worksheet to handle unassigned zip codes.
    3. for each of the worksheet in the original workbook (except the summary sheet) do the following
    4. get each row of the worksheet, find its inspector and copy the data to the end of the corresponding worsheet
    5. if the inspector is not found then copy the data to a "trash" worksheet in the new workbook

  7. #7
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    I can place the refference table anywhere on this workbook. All I need is the raw data included in the worksheet, it does not need to be pretty. lol

    Destroying the old work book to re-sort it into the new "inspector" layout is not an issue at all i can always make a duplicate of the original before hand. Whatever method is easiest.

    You exactly right I want to use the vlookup results to sort all the inspectors into individual worksheets. It does not matter if the workseets are exported as individual files, or if we just make a new workbook containing all the inspector workseets. Again whatever is simplest to do.

    I do not know if we need the Trash worksheet. currently its a very specific coverage area we service and if we do not have a assigned inspector for a zip code, then we label that zip code as NEW VOLUME and I associate that zip code with vlookup that way. But you never know when someone will toss something in, and I like th eidea of the trash sheet just in case there is data not on the lookup.


    If i understand you right we will be putting the vlookup refference table in the first sheet "summary sheet" and than apply the vlookup to all the other worksheets in the workbook.

    Next we will need to create a new workbook or seperate work sheets using the new inspector data.

    Sounds exactly what I need to do.

  8. #8
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    This will take a little time to put together. Do you have an example workbook to work with? If so, you should remove or dummy out any sensitive data and post it here. I can start working on it, but I do need so sample data to make sure it is working.

  9. #9
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    No problem. Do you want the one with the vlookup added to the worksheet? Or just the original i get from the client without anything added?

    Where would you like me to send it to?

  10. #10
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    I will need a reference table containing zip codes and inspector names.

    BTW, do the worksheets contain a header row?

  11. #11
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    yes each worksheet contains the same header row.

  12. #12
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    As soon as you get me some test data, I'll gt you the macro

  13. #13
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    where would you like me to send it to?

  14. #14
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    You can attach it to a message. Use the Go Advanced button and click on the paperclip. You can then upload an attachment. Once you return to the advanced dialog. you clikc on the down arrow next to the paperclip and select the uploaded file. If you preview the post, you can see if the file got attached.

  15. #15
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    Here you go. The Zip/Inspector list is on the summary page, as well as the vlookup i was running.
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    here's something for starters. This workbook contains a macro that is run when you push the Run button. You must provide the input and output workbook file names and the zip code table as well. When you run it, the new workbook is built and saved.

    I had to break the links on the file that you gave me since I couldn't resolve them. I think it should work for you, but you will need to open the linked file first.

    Let me know how close this is to what you want.InspectorSummary.xlsm

  17. #17
    Registered User
    Join Date
    02-21-2011
    Location
    Marine City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Export to new worksheet

    That worked Perfect!!! That is exactly what I needed.
    I had to break the links as well but the new workbook is more than enough for what we will be using it for.

    You are a life saver. Thank you very much.

    Issue definitely Solved, I will be going over this through and through until I understand every bit of the code. Not as bad as I thought with excel just have to get use to the language.

    Again you have been a great help.

  18. #18
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Export to new worksheet

    One great feature of VBA is that you can put your cursor in any keyword and hit F1. You will go directly to help on that keyword. That should help you understand a bit better.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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