+ Reply to Thread
Results 1 to 7 of 7

How to get cell values from one sheet to an other

  1. #1
    Registered User
    Join Date
    10-13-2014
    Location
    Assen, The netherlands
    MS-Off Ver
    2013
    Posts
    27

    How to get cell values from one sheet to an other

    i All,

    I'm afraid the first part of the question must be one of the most "noob" questions ever asked in this forum, but I just can not find how to do this.
    It must be simple, but then again, that's all when you know it :-)

    Here's my question:

    I have made a "userform" to fill in data into cell's on the worksheet "Factuur"
    The information is "Name", "Address", "Phone", "Email" etc. This works like a charm.

    Next part, I have also a worksheet called "NAW" and the information from the fields on "Factuur" (e.g. : "Name", "Address", "Phone", "Email" etc.) should be copied in that sheet.
    The first customer I put in, will have cell A2 till lets say G2.
    The next customer will have A3 till G3, etc.

    There are some tricky parts:
    - Not all the fields are mandatory, so the data from the new customer needs to have a clean "row" (I can not use +1 code for the cells)
    I have no idea how to fix this. When I try to copy the values, and one field is not filled in, my end result is dramatic.


    - The customer needs to get a unique customer-number, This can be simple, like first customer customer ID 1, second 2, etc.
    I know I need to do something with a +1, but I don't know how to do this.

    Help is appreciated!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: How to get cell values from one sheet to an other

    If every customer has a unique customer number, then that would be stored in a column also, and it would never be blank. If it's in column A, use that to find the last active row, and set the new customer number equal to the previous one plus 1.

    Please Login or Register  to view this content.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to get cell values from one sheet to an other

    Hello Fhorst,

    There appears to be some discrepancies between your UserForm3 and your invoice template ("Factuur").

    For example:-
    - from the UserForm, the "Telefoon" entry should go to cell D16, which it does, but on the invoice template, D16 shows as the "Plaats" entry.
    - from the UserForm, the "email" entry should go to cell G16, which it does, but on the invoice template, G16 shows as the "Postcode" entry.

    All the other required entries from the UserForm move up one cell also on the invoice template.
    Perhaps you could restructure your invoice template first.

    There also appears to be a "jumble" of reduced size rows behind the two command buttons (N.A.W. and Verkoop Toevoegen). Is this necessary as it affects the "Naam" entry?

    Can the "Kenteken" entry be used as the client ID? (I'm assuming that "Kenteken" refers to an ID number or such).

    Regards,
    vcoolio
    Last edited by vcoolio; 10-24-2014 at 07:28 AM.

  4. #4
    Registered User
    Join Date
    10-13-2014
    Location
    Assen, The netherlands
    MS-Off Ver
    2013
    Posts
    27

    Re: How to get cell values from one sheet to an other

    Hi vcoolio,

    Yes, you are right! discrepancies.......
    I don't know when this happened, but it did.
    I'm sorry for this.
    It's fixed in the next file (0.03 factuur DHZ macro.xlsm)

    Can the "Kenteken" entry be used as the client ID? (I'm assuming that "Kenteken" refers to an ID number or such).
    I'm afraid this is not an unique enough value. "Kenteken" = licence plate. A customer can have 2 cars, so 2 different licence plates.
    While I'm typing this, it's gets confusing.
    As I can not enter 2 different values in one cell, I guess the licence plate IS a good unique value.
    If one customer has 3 car's, this customer then will be listed 3 times.
    On the other hand, IF the car is sold, and the new owner also comes to us, we would have a problem.

    I know, confusing
    Best way is making column "A" an own unique ID.
    This still does not solve the problem when a customer has 2 or 3 car's, But I guess there is a code possible to check if the Licence plate number exists, and if it does, to make a new row and a new customer ID.

    As for the
    "jumble" of reduced size rows
    . I did not create the original document. Microsoft did. (they created the template for a bill, in the excel 2013, office templates section)

    I also wonder why they started to play around with row sizes, there must be better way to get the end result.
    Any way, we just used the template, and it was this way.

    Natefarm already gave some code, thanks for that!

    It's a push in the good direction.

    As I cleaned up some coding, I truly hope the 0.03 version is more clear.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to get cell values from one sheet to an other

    Hello again Fhorst,

    Well, this may work in regards transferring data to the "NAW" sheet:-

    Please Login or Register  to view this content.
    You will need to go to the "NAW" sheet first and place these headings in row 1:-

    Klant ID/Factuur #/Datum/Naam/Adres/Postcode/Plaats/Telefoon/E-mail

    They need to be entered in the above order, as you see them. You can assign the macro to a button. Perhaps reduce the size of the two existing ones and insert a shape in between them and format it to suit yourself.

    Now, I've entered Klant ID in cell G13 in the code above so you will need to create another title in cell F13 "Klant ID" in the invoice template. I tested it by manually entering a random number in cell G13 and it works just fine. The Klant ID are numbers you can create yourself. For example, start at 1001 and have them increment by 1 on clearing the contents of the invoice. No need to have them as part of your UserForm.

    I entered the above code in Module 2 in your workbook to test it as the module is empty.

    I hope this helps you.

    Regards,
    vcoolio.

  6. #6
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to get cell values from one sheet to an other

    Hello Fhorst,

    Sorry to bother you again, but I just realised that we need to make a slight adjustment to the code.

    In the second last line of code, change :-

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and add this:-

    Please Login or Register  to view this content.
    to the bottom of the code, just above End Sub.

    The code in my previous post would have cleared the Klant ID number and the last line of code above will increment your Klant ID number by 1.

    BTW, I am assuming that you like my idea of the Klant ID!!

    Regards,
    vcoolio

  7. #7
    Registered User
    Join Date
    10-13-2014
    Location
    Assen, The netherlands
    MS-Off Ver
    2013
    Posts
    27

    Re: How to get cell values from one sheet to an other

    Hi Vcoolio,

    Thank you for your input!
    I do like the idea of "Klant ID", but not to show an extra field in the "Factuur" sheet.
    So I made a small change:I made a cell text (number) the same color as the sheet, so you can not see it :-)
    The rest stayed the same.

    Thanks!!

+ 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. Replies: 3
    Last Post: 09-08-2014, 04:29 PM
  2. search cell values based on list of values in other sheet and add color to row
    By darkbraids in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2012, 08:35 AM
  3. Replies: 2
    Last Post: 06-04-2012, 06:57 AM
  4. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2006, 08:33 AM
  5. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 10:33 AM

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