+ Reply to Thread
Results 1 to 4 of 4

Select varying quantity of rows, press macro button to send selection to new workbook

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Select varying quantity of rows, press macro button to send selection to new workbook

    Hello,

    I'm tempted to ask for the entire solution but I'm stuck at the beginning and want to have a go at the rest myself first.

    I'm not sure how to write the code that would allow for me to select any number of rows and with a press of the macro button have that info transferred into a new workbook. It must be with a variable declaration but I'm not sure what the command and syntax is to assign the pre-selected rows to that variable.

    Your help is much appreciated.

    TV

  2. #2
    Valued Forum Contributor
    Join Date
    09-25-2011
    Location
    Eastbourne, England
    MS-Off Ver
    Excel 2010
    Posts
    1,089

    Re: Select varying quantity of rows, press macro button to send selection to new workbook

    Hi TV

    The code will not select the rows for you , but once you have selected some, they will transfer to another workbook.

    I tried to do it with a variable declaration, but failed miserably, so I do hope you are not too disappointed.

    They say that the first part of a problem is always the worst, so now you have got that out of the way, you should be able to finish quite quickly now.

    Regards
    Alastair
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Select varying quantity of rows, press macro button to send selection to new workbook

    Hi aydeegee

    That works really well. Thanks for taking the time for this. I appreciate it.

    I was working on some code and made a bit of headway so I will post it also. It only transfers one row at a time to a lower portion of the same document but also generates a time stamp. The time stamp also prevents the same row from being sent twice.


    Please Login or Register  to view this content.
    Your method adds to the end of the list in the destination document while I was thinking of inserting in Row 2 on the destination document. Is there a best practice for this if order of data does not matter?

    Also, is it good practice to add a line as you have in case of error to goto...? I have seen this used before and I'm wondering if it's used to account for errors not foreseen?

    Thanks again.

    Cheers,

    TV

  4. #4
    Valued Forum Contributor
    Join Date
    09-25-2011
    Location
    Eastbourne, England
    MS-Off Ver
    Excel 2010
    Posts
    1,089

    Re: Select varying quantity of rows, press macro button to send selection to new workbook

    Hi TV

    I do not set myself up as arbiter of best practice - in so many cases the answer is "it depends"

    Where you copy to is a matter of preference, and as long as you have a system to ensure that data is not overwritten, I cannot see that it matters where you put it.

    Error trapping is a useful way to ensure that the VBA is robust. Had I not written the error trap, then if you had tried to run it without the Dest file open, the VBA would have stopped with an error code that would have meant nothing to most people. With the error trap, you know why the VBA has stopped.

    Regards
    Alastair

+ 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. [SOLVED] Macro Button to send Entire Workbook as PDF via email
    By Rosco88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2013, 10:08 AM
  2. [SOLVED] Press a button to SEND data from one worksheet to another based on conditions set by user
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-21-2012, 10:30 AM
  3. Macro to break loop/Sub on button press
    By redders in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-17-2011, 09:52 AM
  4. Randomly Select Varying Number of Rows
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-24-2011, 09:15 AM
  5. Replies: 17
    Last Post: 05-19-2009, 11:34 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