+ Reply to Thread
Results 1 to 22 of 22

Copy and Paste differents ranges

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Copy and Paste differents ranges

    Hi

    I have range B4:J...->...last row in tab "Data"

    if in column C has "Switches" copy from tab "Data" range("C5:J...Last Row") to tab "Report" range("E4")

    if in column C has "Racks" copy from tab "Data" range("C5:J...Last Row") to tab "Report" range("E11")

    if in column C has "Outros" copy from tab "Data" range("C5:J...Last Row") to tab "Report" range("E20")


    Thank you!!!
    Attached Files Attached Files
    Last edited by marreco; 01-21-2015 at 06:38 AM. Reason: wrong write
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Try this...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Hi

    Thak you, but display error
    Run-time error '94'
    Use of 'Null' invalid
    this line yellow
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Hi

    Thak you, but display error
    Run-time error '94'
    Use of 'Null' invalid
    this line yellow
    Please Login or Register  to view this content.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Oopss... Convert the conditions to uppercase

    "Switches", "Racks", "Outros"

    to

    "SWITCHES", "RACKS", "OUTROS"

  6. #6
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy and Paste differents ranges

    Can you test this

    Please Login or Register  to view this content.

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Try this revised one

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    I still make something wrong becouse error continue display.

    Maybe you can look my file in #1

  9. #9
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy and Paste differents ranges

    In your attachment... Column B has the values of Swiches, Racks..... not in Column C..

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Quote Originally Posted by marreco View Post
    I still make something wrong becouse error continue display.Maybe you can look my file in #1
    I was written that code without seeing your file

    My Post #7 code is working fine by changing "C" to "B"

  11. #11
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Yes, i need comparing B column, but copy C:J column

  12. #12
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Copy and Paste differents ranges

    Given codes should the same....

  13. #13
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    hi Sixthsense

    after run your code, coping to uniq destination.

    in my file i hve small tables inside tab "Report"

  14. #14
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Quote Originally Posted by marreco View Post
    after run your code, coping to uniq destination.
    Tested and working fine at our end

  15. #15
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Look image and you understand my intention.


    Thank you!!
    Attached Images Attached Images

  16. #16
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Copy and Paste differents ranges

    Quote Originally Posted by marreco View Post
    Look image and you understand my intention.
    Your intention was very clear to us and we given our solution based on your requirement

  17. #17
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy and Paste differents ranges

    I have adjusted the code you have on the module.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Hi AB33, thank you, perfect solution!!!

    Thank you very much!!!!!!!!

  19. #19
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    Hi AB33, way in my adaptation, your code run but nothing happening?

    code is inside module sheet3 (portuguese is Plan3 ("Painel") )

    Thank you!!
    Attached Files Attached Files

  20. #20
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy and Paste differents ranges

    Amended code:
    Attached Files Attached Files

  21. #21
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy and Paste differents ranges

    You have a great knowledge.

  22. #22
    Registered User
    Join Date
    12-16-2014
    Location
    ZG
    MS-Off Ver
    2013
    Posts
    1

    Re: Copy and Paste differents ranges

    Not to open new thread I will ask on this one:

    I am trying to copy value from two specific cells to specific cells in another sheet.
    Problem is that I have many cells in first sheet and some of them are empty. Also paste is always 99 times, just range changes. Is there a loop to make everything more easy?

    Here is my attempt

    Sub copytry()
    Worksheets("sheetI").Range("I17:J17").Copy _
    Destination:=Worksheets("sheetII").Range("F1352:F1451")
    Worksheets("sheetI").Range("I18:J18").Copy _
    Destination:=Worksheets("sheetII").Range("F1452:F151")
    End Sub

+ 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] Change Copy to Copy & Mirror Image the Copy
    By mills49 in forum Excel General
    Replies: 5
    Last Post: 08-21-2014, 05:25 AM
  2. Saving copy of data and then running macro on all active worksheets in saved copy?
    By Science87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2014, 11:56 AM
  3. Save copy as, open copy, alter copy, save copy and close copy
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2013, 04:42 PM
  4. Copy one cell to an other but colors do not copy. While not using clipboard to copy.
    By chuckchuckit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2010, 03:08 AM
  5. EXCEL FILE a copy/a copy/a copy ....filename
    By ve in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-29-2005, 05:05 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