+ Reply to Thread
Results 1 to 19 of 19

Copy/Paste Active Cell to new worksheet problem

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Copy/Paste Active Cell to new worksheet problem

    I am trying to create a Macro that will copy and paste an active cell (example: A2) and the eight columns to its right (A2,B2,C2,D2,E2,F2,G2,H2) on Sheet1 to a specific cell (B11) on the other worksheet (Sheet2). Below is the code I am using but I seem to be getting errors constantly. Could someone please look it over and let me know what exactly the problem is?

    Please Login or Register  to view this content.

    Any help would be greatly appreciated!

    Regards,
    ipmaham
    Last edited by Cutter; 08-07-2012 at 01:47 PM. Reason: Added code tags

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    Are you always copying to B11 or to the next blank cell after B11?

  3. #3
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    All the cells being copied from Sheet1 will be random for the most part usually switching from (A2,B2,C2,D2,E2,F2,G2,H2) to (A3,B3,C3,D3,E3,F3,G3,H3) to (A4,B4,C4,D4,E4,F4,G4,H4) and so on. But I will be manually triggering the Active cell A2, A3, A4.

    The cell on Sheet two will always be B11 every time.
    So B11:J11, on Sheet2, will contain the section from Sheet1 of (A2,B2,C2,D2,E2,F2,G2,H2).

    Thanks for the quick response!

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    Hello there,

    Try the following

    Please Login or Register  to view this content.
    To insert the code

    1.Press Alt+F8 on your keyboard
    2.Clear the macro name box and type CopyCellRow in the blank box provided
    3.Select the Create option
    4.In between the Sub CopyCellRow() and End Sub copy and paste the above code.
    5.Exit out of the Visual Basic Window
    6.Select the cell whose row you want to copy and Press Alt+F8 again and this time select the CopyCellRow macro
    7.Select Run

    Let me know if this works for you!

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    When using this method, will I have to select the cells (A2,B2,C2,D2,E2,F2,G2,H2) or just click the single cell?
    Because it seems that by using this method I will have to select the number of cells and then run the macro to transfer the information to Sheet2. If this is the case, would you know how to do it the original way presented? Because I have 10,000+ lines to go through. So the extra few minutes i save will go a long way.


    Thanks,

    ipmaham

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    With this you just select a single cell in the row you want to copy over.

  7. #7
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    Perfect, I'll give it a go here in a bit and report back. Thanks for all the help so far rvasquez! It's really appreciated.

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    No problem, since you have so man rows you may want to assign a short cut key to the macro so that you can just press Ctrl and whatever letter you specify to run it.

    Thanks!

  9. #9
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    That's exactly what I was going to do. I already have a macro set up to save by a specific cell value in Sheet2 and it is assigned to a key.

    Here is a thought. Is there a way to run this macro and the pause a second, and then run another macro?

  10. #10
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    Just add the name of the second macro below the last line of code before the End Sub of the code I gave you.

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Copy/Paste Active Cell to new worksheet problem

    @ ipmaham

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  12. #12
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    rvasquez ,

    where exactly do I insert this code? do i place it in my original code on the bottom? Or just replace it all, I wouldn't think that though.

    Quote Originally Posted by rvasquez View Post
    Hello there,

    Try the following

    Please Login or Register  to view this content.
    To insert the code

    1.Press Alt+F8 on your keyboard
    2.Clear the macro name box and type CopyCellRow in the blank box provided
    3.Select the Create option
    4.In between the Sub CopyCellRow() and End Sub copy and paste the above code.
    5.Exit out of the Visual Basic Window
    6.Select the cell whose row you want to copy and Press Alt+F8 again and this time select the CopyCellRow macro
    7.Select Run

    Let me know if this works for you!
    [COLOR="Silver"]

  13. #13
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    If I read your first post correctly copy it over your original code. So that it look like:

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    Works like a charm! You really helped out a lot. I greatly appreciate it!
    Last edited by ipmaham; 08-07-2012 at 06:22 PM.

  15. #15
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    Actually, I have one last problem... sorry....
    After verifying all the information I realiuzed the that save as needs to only save Sheet2 and not Sheet1.

    Is there a way to use the code below so that only Sheet2 is saved in the new file? Please see code below.


    Please Login or Register  to view this content.
    Last edited by ipmaham; 08-07-2012 at 06:14 PM.

  16. #16
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    Maybe try this:

    Please Login or Register  to view this content.

  17. #17
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    Hello there, try this
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    08-06-2012
    Location
    Eagel River
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Copy/Paste Active Cell to new worksheet problem

    Much appreciated, but I got it working with the help you provided on the 8th.

    Thanks a lot!

  19. #19
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Copy/Paste Active Cell to new worksheet problem

    LOL sorry about that, please mark this thread solved.

    Thanks!

+ 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