+ Reply to Thread
Results 1 to 11 of 11

VBA program to copy and paste cells from sheet2 to sheet1

  1. #1
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Cool VBA program to copy and paste cells from sheet2 to sheet1

    Good Afternoon
    I would like to implement a VBA program which basically copy and paste group of cells from sheet 2 to sheet1.
    Very important; it should paste them in the cell I'm actually selecting and not in a specific cell.

    The idea is to create a program able to add group cells (with fomulaes adn format included) in a specific cell, in order to speed up the normal process of copy and paste.

    So the buttons should be able to copy and paste the block of cells of the second image (sheet2)


    Is that possibile?

    Let me know

    Thank You in advance.

    Andrea
    Attached Files Attached Files
    Last edited by paind; 11-13-2019 at 11:09 AM.

  2. #2
    Forum Guru Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    10,981

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    Hi
    have you taken a moment to read the yellow banner?
    Be very, very careful using IFERROR ! It hides ALL errors which is not always what you want to get correct results

  3. #3
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    You're right, my bad.
    I'm gonna modify the content.

    Thank You

  4. #4
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    Quote Originally Posted by Pepe Le Mokko View Post
    Hi
    have you taken a moment to read the yellow banner?
    You're right, my bad.
    I'm gonna modify the content.

    Thank You

  5. #5
    Forum Guru Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    10,981

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    And while you are at it
    Administrative Note:


    although we value privacy as much as anyone else, it could be important that members have a rough idea of your location. You might in the future post questions which are bound to your regional settings.
    So, please update your profile to something more precise then "asasd" ( country will suffice, no need to be more precise).
    Thank you for helping us to help you

    Administrative note

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version. Your profile does not indicate your version.
    Thanks

    And take a minute to read our forum rules

  6. #6
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    Done it, I'm sorry
    Last edited by Pepe Le Mokko; 11-13-2019 at 11:13 AM. Reason: Removed unnedessary quote - Use the Quick Reply instead

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,097

    Cool Hi ! Try this !


    Same code whatever the button, a beginner starter demonstration you must paste to the (Sheet1) worksheet module :

    PHP Code: 
    Sub Demo1()
        
    Dim VRg As Range
            V 
    Application.Caller:   If IsError(VThen Exit Sub
        Set Rg 
    Sheet2.UsedRange.Find(Me.Shapes(V).TextFrame.Characters.Caption "*", , xlValuesxlWholexlByRows)
         If 
    Rg Is Nothing Then Beep: Exit Sub
            Rg
    .CurrentRegion.Copy ActiveCell
        Set Rg 
    Nothing
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon Add Reputation !
    Last edited by Marc L; 11-13-2019 at 12:51 PM. Reason: adding where to paste

  8. #8
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: Hi ! Try this !

    Amazing, Thank You!!

  9. #9
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    Thank You, but I have another question.

    I would like to create a sort of recursive computation between cells with the same colour.

    The last green cell must be the sum of the near yellow cell and the previous green cell.
    (roughly speaking green2= yellow2+green1, green3=yellow3+green2 and so on)

    How can I implement a macro like this?

    You can find the Excel file in attached.

    Thanks again!

    Andrea
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    5,097

    Arrow

    Why do not use directly formula in cells ?

    If really a code is necessary, as per forum rules like it's a totally different subject, you have to close this one
    and to create a new thread for your new need but this time with an attachment with something to sum

  11. #11
    Registered User
    Join Date
    11-13-2019
    Location
    Barcelona
    MS-Off Ver
    Excel for Mac 16.3
    Posts
    11

    Re: VBA program to copy and paste cells from sheet2 to sheet1

    ok thank You, I'm going to open a new one in another section.

+ 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. Copy & Paste from Sheet1 to Sheet2
    By Spikyd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2018, 03:35 AM
  2. [SOLVED] Copy cells from sheet1 to sheet2 and paste to a new row each time.
    By A440 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-29-2015, 09:45 PM
  3. Type Y or T to copy and paste specific cells from sheet1 to sheet2
    By xlwa220x in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-16-2014, 08:20 AM
  4. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  5. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  6. Copy 3 cells from sheet1 then paste to sheet2
    By Christeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-10-2011, 09:16 AM
  7. Copy cells sheet1, paste to sheet2
    By Flintstone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2005, 04:21 PM

Tags for this Thread

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