+ Reply to Thread
Results 1 to 32 of 32

Form a customer list from invoices

  1. #1
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Form a customer list from invoices

    I'm trying to figure out a way to get my invoice templates to copy the names and addresses from them to another worksheet to form a customer database if you will.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Can you supply a sample workbook, so somebody can help you?

  3. #3
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Can you supply a sample workbook, so somebody can help you?

    Sorry about the repeat post.

    These are the two workbooks:

    Customer Details.zip

    Proposal.zip

    (Hope I did this right.)

  4. #4
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Anyone please?

  5. #5
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Form a customer list from invoices

    Are you going to have every proposal on a different tab in the proposal workbook?

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Try this out, Ensure both workbooks are open, click the button in Proposal1 to send the data to Customer Details.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Try this out, Ensure both workbooks are open, click the button in Proposal1 to send the data to Customer Details.

    Thanks Dave, however I get an error message:
    Run-time error '9':
    Subscript out of range


    how do I debug this?

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    Thanks Dave, however I get an error message:
    Run-time error '9':
    Subscript out of range


    how do I debug this?
    Are both workbooks open?

  9. #9
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by khamilton View Post
    Are you going to have every proposal on a different tab in the proposal workbook?
    No. Each one will be on a separate workbook and saved separately.

  10. #10
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Are both workbooks open?

    Yes. I opened both of the ones you sent.

  11. #11
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    Yes. I opened both of the ones you sent.
    The error usually happens when the code cannot find the other workbook, these would mean the workbook is not opened or you have saved it in a different name.

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    Yes. I opened both of the ones you sent.
    Here it is again, just zipped.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    The error usually happens when the code cannot find the other workbook, these would mean the workbook is not opened or you have saved it in a different name.

    I actually didn't save either one. Did I need to?

  14. #14
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    I did now save both workbooks you sent into the same directory without changing either name. Still the same error.


    Edit: I also downloaded your zipped files as well with the same results.
    Last edited by coffcons; 11-21-2009 at 05:20 PM.

  15. #15
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    I did now save both workbooks you sent into the same directory without changing either name. Still the same error.


    Edit: I also downloaded your zipped files as well with the same results.
    I am not sure why, what exactly are you doing? as that error should only happen if Customer Details were not open. When you press DeBug where do you end up?

  16. #16
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    I am not sure why, what exactly are you doing? as that error should only happen if Customer Details were not open. When you press DeBug where do you end up?
    I end up at the first line of the module :
    Please Login or Register  to view this content.
    I assure you that both workbooks are open.
    Last edited by coffcons; 11-21-2009 at 06:28 PM.

  17. #17
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    I end up at the first line of the module :
    Please Login or Register  to view this content.
    I assure you that both workbooks are open.
    Maybe you need to dim the variables try this.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Maybe you need to dim the variables try this.
    I didn't see any difference in that last file that you sent, and the results were the same. I did make some small progress, however. I added the file suffix (.xls) to the workbooks in your code and I don't get that error message anymore. The problem that I now have is that either the specified range or the offset is wrong because I'm getting my company heading copied over every time instead of the customers names and addresses.

    Can you show me how to address that?

  19. #19
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    I didn't see any difference in that last file that you sent, and the results were the same. I did make some small progress, however. I added the file suffix (.xls) to the workbooks in your code and I don't get that error message anymore. The problem that I now have is that either the specified range or the offset is wrong because I'm getting my company heading copied over every time instead of the customers names and addresses.

    Can you show me how to address that?
    I don"t know what is wrong, you should not have had to change anything.
    What version of XL are you using?

  20. #20
    Registered User
    Join Date
    11-20-2009
    Location
    England
    MS-Off Ver
    Excel 2010 @ Work and Excel 2007 @ Home
    Posts
    10

    Re: Form a customer list from invoices

    I get subscript out of range too, I'm using xl2002. If I change the code to this it works:

    Please Login or Register  to view this content.
    edit: too slow! I see you got there already.

  21. #21
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    I don"t know what is wrong, you should not have had to change anything.
    What version of XL are you using?



    2002. I did exactly what 'Coder' did below in the next post. This allows it to find the books, but like I say the cells it is sending over are the wrong ones. I'm getting my Company header. Thanks.

  22. #22
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by Coder View Post
    I get subscript out of range too, I'm using xl2002. If I change the code to this it works:

    Please Login or Register  to view this content.
    edit: too slow! I see you got there already.


    Yes, exactly! That's precisely what I did. That gets it to find the workbooks but now I'm trying to better identify the proper cells.

  23. #23
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    2002. I did exactly what 'Coder' did below in the next post. This allows it to find the books, but like I say the cells it is sending over are the wrong ones. I'm getting my Company header. Thanks.

    I kept playing with it and I think that I finally figured it out. I see now that the second "range" describes the referenced cells and once I figured out and then changed the range cells to where they should be, I was able to get the proper transfer.

    Thank you for all the help.

    I just thought of something that might affect this working properly. This 'Proposal' form is a template form that when filled out for each new customer, subsequently gets re-named and filed in that customer's folder. Does this mean that I'll need a new macro with new code each time I use this or does it somehow automatically get changed on its own. I suppose the alternative would be to save the form under the same name. The problem of course is that it doesn't allow for unique file names. Sorry for my naivete.
    Last edited by coffcons; 11-21-2009 at 08:54 PM. Reason: additional thought.

  24. #24
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    Yes, exactly! That's precisely what I did. That gets it to find the workbooks but now I'm trying to better identify the proper cells.
    LOL, I had named the ranges to the cells in the Company header, if you click on the Company Header, Select the Company name and you will see the name of the cell is "Name", Click on the Phone Number and you will see the cell is named "Phone". That is what is getting transferred to the other Workbook.

    If you go to Insert=>name=>define Click on one of the names and change the cell reference to the cell reference you want.

    Sorry for the confusion.

  25. #25
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    LOL, I had named the ranges to the cells in the Company header, if you click on the Company Header, Select the Company name and you will see the name of the cell is "Name", Click on the Phone Number and you will see the cell is named "Phone". That is what is getting transferred to the other Workbook.

    If you go to Insert=>name=>define Click on one of the names and change the cell reference to the cell reference you want.

    Sorry for the confusion.


    Thanks Dave,

    I figured that out and got it all to work properly. Thanks for getting me set up with that code.

    I wonder if you have any ideas about my other question. Namely that I would prefer to be able to save each new 'proposal1' form under a more specific name in that particular customer's folder. Is there a function that allows for this?

    Perhaps 'ThisWorkbook' or "ActiveWorkBook" functions?
    Last edited by coffcons; 11-22-2009 at 06:08 PM.

  26. #26
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    I believe this should work for you. This will create a Subfolder in a folder named "CustomerTest", which will already exist.
    Please Login or Register  to view this content.

  27. #27
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    I believe this should work for you. This will create a Subfolder in a folder named "CustomerTest", which will already exist.
    Please Login or Register  to view this content.
    I fixed the xls file extension issues that I had with the previous code, but the error I'm getting with this code is the line
    Please Login or Register  to view this content.
    this is what the debugger points to. I even made a workbook with that name to see if that would help and I tried adding the xls extension also without luck. Any ideas?

  28. #28
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    I fixed the xls file extension issues that I had with the previous code, but the error I'm getting with this code is the line
    Please Login or Register  to view this content.
    this is what the debugger points to. I even made a workbook with that name to see if that would help and I tried adding the xls extension also without luck. Any ideas?
    Try the macro recorder to see what the code does for you.
    hit record macro, press F12, change the directory and select a file, stop the recorder and look at what the code gave you.
    My last post said that "CustomerTest" folder had to already exist.

  29. #29
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Try the macro recorder to see what the code does for you.
    hit record macro, press F12, change the directory and select a file, stop the recorder and look at what the code gave you.
    My last post said that "CustomerTest" folder had to already exist.

    Please bear with me, I'm trying.

    If I did this correctly, the recorded macro ends up as this:
    Please Login or Register  to view this content.
    I have a new file named 'CustomerTest' saved.

  30. #30
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Try this.
    Please Login or Register  to view this content.

  31. #31
    Registered User
    Join Date
    11-24-2007
    Posts
    43

    Re: Form a customer list from invoices

    Quote Originally Posted by davesexcel View Post
    Try this.
    Please Login or Register  to view this content.
    It works! Thanks.

    I removed the 'Sub Macro' heading and attached the rest to the bottom of your other code after removing the last 'CHDIR' part. This automatically (after clicking the macro button) saves the proposal in a folder with that customers name and also saves the customers name in a separate worksheet.

    Thank you for your patience.

  32. #32
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Form a customer list from invoices

    Quote Originally Posted by coffcons View Post
    It works! Thanks.

    I removed the 'Sub Macro' heading and attached the rest to the bottom of your other code after removing the last 'CHDIR' part. This automatically (after clicking the macro button) saves the proposal in a folder with that customers name and also saves the customers name in a separate worksheet.

    Thank you for your patience.
    Great, glad it worked.

+ 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