+ Reply to Thread
Results 1 to 22 of 22

Copy & Paste Row

  1. #1
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Copy & Paste Row

    The Attachments contains a macro copying rows from a sheet and Paste to another sheet based on the row number , I want to copy and paste based on sequence in column A .
    Attached Files Attached Files
    Last edited by aimanraya; 04-16-2014 at 11:30 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    This code will insert the rows at the position (cell selected by the user)...

    Please Login or Register  to view this content.
    This code will insert the row at the position (number typed by the user)...

    Please Login or Register  to view this content.
    Regards,
    Rudi

  3. #3
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    The first code ,when the InputBox show to Select the cell that you want to start at , I can select only one because the InputBox show is active so I cant move down (it prevent me ). Also the second code , there is any way to able me move down sheet during InputBox show , I hope you understan me .

  4. #4
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    The second code , When I typed number 50, 100 , 150 .. It paste row below 49 , 99 , 149 . Also when I enter a number that does not Found in sequence, can show MsgBox " was not found!" ? Sorry I dont remark '+ 1 (Uncomment this line to insert rows below NumberRow) . only I want MsgBox if I typed any number not found , very tanks dear Rudis .
    Last edited by aimanraya; 04-16-2014 at 05:37 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Hi,

    In both the code blocks, the rows will now be inserted *below* the indicated number.
    Since the inputbox is an Application.Inputbox(...) it does allow for scrolling to numbers further down the list. In other words, when the inputbox is showing, you can either use the mouse wheel to scroll down, or you can drag the scroll bar of Excel down.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    The second code is very very well , I prefer to use , But the first the same problem ,when I Select the cell that i want to start at , then I select agree , then " Do you want to paste again ?" I select YES , After this I cant paste again , the mouse wheel do not scroll down .

  7. #7
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    I greet you, you're a genius

  8. #8
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Hello Aiman,

    I tested the first macro and I understand that you mean. Sorry about that. It's something I overlooked.
    I have fixed this one too (even though you say you prefer macro #2).

    Have a great day.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    Excuse me, request a last resort , If I want to copy a single row of sheet and paste more than one row in another sheet based on the row number , I want to copy and paste based on sequence in column A . Please see the attachment
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Hi,

    Try this code....

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    Both of two codes does not work when the sheet has protected .
    Last edited by aimanraya; 04-17-2014 at 04:11 AM.

  12. #12
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Hi,

    You can add a line: Activesheet.Unprotect at the top of the macro.
    And a line: Activesheet.Protect at the very bottom of the macro.

    Do this for whichever macro you are using (and if the sheet has a password of course).

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    Fantastic, I tried to the last code , I will try to the others , and tell you .

  14. #14
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    I am grateful to you, and best wishes to you for success .

  15. #15
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Good to know...
    Enjoy!

  16. #16
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    New problem :
    The sequence in column A is not values But formulas, and this led to the macro performs based on the row number and not the serial (The sequence) in all codes.

  17. #17
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    If the column contains formulas, then we need to change the Find command to search for *values* and not the *true* content of the cells.

    The following version should work:

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    Thank you very much ,I replaced the old line with this new below line, and all things very good .

    lStart = Range("A:A").Find(What:=NumberRow, LookIn:=xlValues).Row + 1

  19. #19
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    If NumberRow = 0 Then Exit Sub

    If NumberRow1 = 0 Then Exit Sub

    because of the above two lines , If I do not enter any value "Cancel" , the protection would be canceled , I used Else in the first line instead of Exit Sub , so it is good , but it is difficult to use Else again in the other line .can you modify please ? .
    Last edited by aimanraya; 04-22-2014 at 01:42 PM.

  20. #20
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Hi,

    This will re-enable the protection if you cancel the row number message...

    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    04-07-2014
    Location
    Egypt
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Copy & Paste Row

    Thank you very much for your help, God bless you .

  22. #22
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Copy & Paste Row

    Thank you. It's a pleasure to assist.

+ 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] Copy Paste Loop ends before copy/paste is finished
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2013, 04:01 PM
  2. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  3. Replies: 1
    Last Post: 01-16-2013, 05:36 AM
  4. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  5. Replies: 1
    Last Post: 01-04-2005, 06:06 PM

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