+ Reply to Thread
Results 1 to 8 of 8

Transferring Rows Across Worksheets

  1. #1
    Registered User
    Join Date
    08-05-2008
    Location
    NY
    Posts
    8

    Transferring Rows Across Worksheets

    I've been struggling with this one for a few days now. I have three worksheets. The first is an initial list, the second is an active list, and the third is a final list. I want to create a button or some function on each row so that when it is clicked, the row will automatically move over to the first empy row in the next sheet. Any ideas? Thank you.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, This requires just one Button, when clicked, an "Input box" appears, and you Select the row for moving.
    Click OK and the row is "Cut" and pasted into the next sheet.
    You will have to copy this code for the other sheets as required.
    make sure your "sheet name" is the same as the "sheet name" in the code.
    If you want to "Copy" not "Cut" change the code to suit
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    08-05-2008
    Location
    NY
    Posts
    8
    Mick,

    Thanks so much for responding. I'm just confused as to where I put this code in. I have the tool box open to create a button. What is my next step? Thank you.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, Have a read of this :-

    Inserting a Command Button in a worksheet and Allocating Code

    Open your workbook at the Sheet Number with your Data that you want to Manipulate.
    Click View, Toolbars, Control ToolBox,---- Control ToolBox Menu Appears on sheet.
    Slide you cursor over the Tool Box (Tool Tip Text) until you find a Command Button.
    Click It then click Somewhere on the sheet.-- Command Button appears on sheet.
    The Command Button will have handles round its edge, This is so you can Position it on the sheet.
    Click the command Button "Hold the Mouse Click Down" and Drag the Command Button to where you want it.
    Double Click the Command Button, The VB Editor window will appear.
    You can also open the Editor By clicking Alt + F11, but if you double click the Command Button the editor will open in the procedure relating specifically to your Command Button.
    If the VB Editor window has two panes the right pane is where you must paste your code.
    The left pane can be "Project Window" or "Properties Window, Click (Ctrl+R) if not showing.

    Paste your code just under the words "Private Sub CommandButton1_Click() " in the Right hand pane.
    If you have done this correctly. Scroll to the bottom of the code and you should see the words "End Sub"
    On the VB Window, Toolbar you will see a Green Triangular shapes icon,.
    This is to change the VB Editor mode from "Run Mode" to "Design Mode "
    Click this Icon, The Small blue square to its left will change from light blue to dark blue, or Vice Versa. Before you close the Editor make sure this Square is "Dark Blue" i.e. (Reset)
    Sometimes the it will appear Reset when it is not, that why I usually put a message at the bottom of the code, to know if is run or not.(Not in this Case, see below)
    Close the Editor. Select the Command Button and Click it.
    When the code Runs the Msgbox should appear With The Message "Transfer Complete" ,if this doesn't happen Open The VB Editor "Alt + F11" and click the "Reset ( Blue Square) and or The "Green Triangle" on the Tool bar . The Blue Square should be "Dark Blue ", in order to run the code..
    NB:- If you want to get back into this specific code through the Command Button.
    Get the Controls ToolBox menu back on the screen, Click the green triangle, When you slide the cursor over your Command button , The cursor shape will change to a "Arrow Headed Cross" , you will then be able to double click it to view your code.
    If you prefer, you can forgo all this hassle by putting the code in an MT macro, with a key combination like (Ctrl+"A") to run it.
    If you still get a problem , call back
    Regards Mick

  5. #5
    Registered User
    Join Date
    08-05-2008
    Location
    NY
    Posts
    8
    Mick-

    I have followed those instructions. I'm not getting the "Transfer Complete" though. The reset button is either highlighted or not, so I'm not sure what "dark blue" is. I'm guessing I must have done something wrong because when I click the command button, it gives me a window titled "Transfer Row" and then "Please Select a Row." When I highlight a row and press ok, nothing happens. Thoughts? Thanks so much for your help.

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi I've just copied the code back and its working OK.
    It's probably because your destination sheet name does not MATCH the sheet name in the code.
    They must be exactly the same:- Sheet Name = "active list" (without the Inverted Commas.)
    The code below is the same as the old code but with a message Box.
    You don't really need it because if your code is working the row you select (With the mouse) will be left Blank after the code has run.
    Try again
    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 08-09-2008 at 08:34 AM.

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Sorry Editing problems !!!

  8. #8
    Registered User
    Join Date
    08-05-2008
    Location
    NY
    Posts
    8
    Yup, that was the problem. Works great. Thanks Mick!!

+ 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