+ Reply to Thread
Results 1 to 10 of 10

Press a button to SEND data from one worksheet to another based on conditions set by user

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Press a button to SEND data from one worksheet to another based on conditions set by user

    Attachment: LITERATURE-ENGL.xlsm

    Hello!

    ATTACHED IS THE FILE IN QUESTION!

    In short: I need columns from one worksheet, to be sent to replace specific columns in another worksheet by the click of a "Send" button. However the columns in the receiving worksheet aren't in sequence. Also, the columns to be replaced are determined by the "selected month" the user selects in a dropdown menu. By the way, if what I'm asking for is impossible, let me know... maybe you can suggest a different way to get the end result.


    First, a clear short explanation... (if it helps)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    User determined months:
    SELECTED MONTH result returned in: (Sheet1 "J15")
    FOLLOWING MONTH result returned in: (Sheet1 "J16")

    SEND BUTTON: (Sheet1 "O19")

    HERE IS WHAT THE "SEND" BUTTON NEEDS TO DO:
    1. Send values from column 'Pounda' (Sheet1) to replace values in 'P' (Sheet3) SELECTED Month
    2. Send values from column 'Stanje' (Sheet1) to replace values in 'Stanje' (Sheet3) SELECTED Month
    3. Send values from column 'Ulaz' (Sheet1) to replace values in 'Ulaz' (Sheet3) FOLLOWING Month
    4. Delete values from column 'P' (Sheet3) FOLLOWING Month
    5. Delete values from column 'Stanje' (Sheet3) FOLLOWING Month




    Now for the same explanation, but with details:
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    First, let me explain the layout of the worksheets...

    (Sheet1): "Inventura"
    Here the user identifies the "selected month" using a drop down menu, which returns a result in ("J15") as the number of the month. (i.e. May=5). And automatically calculated result of the "following month" is in ("J16").

    The user also enters values in 3 separate columns...
    1. Ponuda ("C7:C91")
    2. Stanje ("D7:D91")
    3. Ulaz ("E7:E91")

    The "SEND" button is in ("O19"), that's the one that I need your help with

    -----------------------------
    (Sheet3): "Arhiva"
    This sheet has exactly the same publications listed. And contains information of the entire year. However, it begins with September and ends with August. Each month contains 4 columns of information.


    -----------------------------
    Now here's what I need help with...

    In (Sheet1) "Inventura"
    First the user selects a "month" from the dropdown menu ("C3"). Then by clicking the "SEND" button in ("O19") I need all the values from columns ("C7:E91") to be sent over to (Sheet3) "Arhiva" and replace existing values there in a particular way.

    Here is one example... First, let's suppose the user chose MAY to be the "selected month"

    By clicking "SEND" the values from the column:
    'Ponuda' (Sheet1 "C7:C91") is sent to replace values in (Sheet3 "AJ7:AJ91")
    'Stanje' (Sheet1 "D7:D91") is sent to replace values in (Sheet3 "AL7:AL91")
    'Ulaz' (Sheet1 "E7:E91") is sent to replace values in (Sheet3 "AO7:AO91")

    Please note that the months correspond to both sheets. While columns ('Ponuda' and 'Stanje') replace values for MAY in (Sheet3), the column 'Ulaz' actually needs to replace values for JUNE, which is the "following month."

    So that's the idea. The two columns ('Ponuda' and 'Stanje') always replace values in the corresponding months... while the 'Ulaz' column, needs to replace values for the "following month's" 'Ulaz' column.

    In addition to that, the "SEND" button also needs to delete any values in the other two columns for only the "following month," which would mean JUNE for our example. In other words, all values for JUNE in (Sheet3) columns 'P' ("AN7:AN91" ) and 'Stanje' ("AP7:AP91") need to be deleted.


    Reminders
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Keep in mind that there is other code already in the workbook. Also, that (Sheet3) does contain the entire year, but starts with September and goes to August. That means that when August is the "selected month", then the "following month" would be September which is at the very beginning of the worksheet.

    I realize that one "SEND" button may not be able to do all this work with just one click. I'm open to suggestions, or perhaps more buttons that the user must click on.

    Thank you for your help!!!

    Attachment: LITERATURE-ENGL.xlsm
    Last edited by nenadmail; 05-21-2012 at 05:54 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    is there a specific reason you want the data to be "Sent at the Press of a Button"?

    my reason for asking is, although i have not yet looked at your file, it sounds like a vlookup would give you what you need, and would do so automatically, and without the user doing anything other than entering the "selection criteria"?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    Yes. (Sheet3) cannot be compromised by inadvertently selecting the wrong month. If he is mistakenly updating the values, and forgets to change to the correct month. Then he is technically editing crucial information that has been saved in (Sheet3). However, by making sure all data is correct, then in the end sending the information, he is given the chance to make sure all is correct before he permanently edits (Sheet3).

  4. #4
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    Attachment: Attachment 157003

    Here's I attached the file in question.
    Attached Files Attached Files
    Last edited by nenadmail; 05-21-2012 at 05:55 AM.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    hi nenadmail, please check attachment, press "Send". I've attached different Excel version formats just in case

    the code assigned to the button:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    I missed Ulaz copying, this corrects this:

    Please Login or Register  to view this content.
    You have some events code in the workbook. I can not say I understood logic of some of them to take that into account in the current code.

  7. #7
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    I was just going to mention that error. Thanks...
    However, there are other errors.

    1. I noticed you created a new dropdown menu for the months. However, there already exists one from before. It is located in the box ("O3"), next to the other buttons. Each month is displayed in the Croatian language, but you can understand that because the number of the month is also displayed. AND the numberical value of each month chosen is returned in: ("J15"), currently hidden. While the "followingmonth" is also already calculated and automatically returned below that ("J16").

    2. When I tested it with months (1-6) it seems to work fine. However, when I try months (7-12) it returns an error "Month lookup error."

  8. #8
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    I managed to fix the error the first issue, that is with the dropdown menu, now it's no problem. But I don't know how to fix the second issue... Months (7 through 12) return an error: "Month lookup error."

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    1.
    Quote Originally Posted by nenadmail View Post
    1. I noticed you created a new dropdown menu for the months. However, there already exists one from before. It is located in the box ("O3"), next to the other buttons.
    Quote Originally Posted by nenadmail View Post
    In (Sheet1) "Inventura". First the user selects a "month" from the dropdown menu ("C3").
    2. Please check attachment, the code has been corrected. I've amended code to take into account the logic of the Calculate event code.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Press a button to SEND data from one worksheet to another based on conditions set by u

    Excellent job!!! It's perfect. Thank you very much!

+ 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