+ Reply to Thread
Results 1 to 12 of 12

VBA (Buttons) To copy and paste into separate sheet

  1. #1
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    VBA (Buttons) To copy and paste into separate sheet

    Hi,

    I am trying to write a code so that I can insert a command button and it will copy 4 separate columns and drop them into a second sheet.
    There are three sheets which I want to take information from, and paste into one drop point, what I can't work out is how to get it to paste under information that has already been dropped across.

    There are also headers in the 3 sheets which I need to omit.

    I have attached a template worksheet for an example of what i'm trying to do.

    In Spreadsheet "BACS Prepay"
    The columns I am trying to pull through are "D", "F", "H", and "K" - "Row 5 is the Header" to omit

    In Spreadsheet "BACS"
    The columns are "B", "D", "H", and "K" -"Row 3" is the header

    In Spreadsheet "Cards"
    The columns are "B", "D", "F", and "J" - "Row 4" is the header

    So this ideally would drop into Spreadsheet "Report" to
    "A","B","C", and "D" respectively with "Row 1" being the header.
    the problem I had was that it would just paste over information that I copied across and I couldn't get it to go under what had already been carried over.

    I have been trying to learn through youtube tutorials but struggling a bit!

    Any help would be greatly appreciated!
    Attached Files Attached Files
    Last edited by T.Turner; 01-15-2020 at 12:13 PM.

  2. #2
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: VBA (Buttons) To copy and paste into separate sheet

    there is nothing in row 8 and 9 in BACS Prepay sheet-why?

  3. #3
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    I forgot to delete the rows when i copied it over to this dummy sheet but normally there isn't that gap.

    Would it impact the VBA if there was a gap in the rows?
    Last edited by T.Turner; 01-15-2020 at 06:51 PM.

  4. #4
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: VBA (Buttons) To copy and paste into separate sheet

    ok here is the macro for you then -just run this after you delete row 8 and 9
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    Thank you, I will try it tomorrow when I'm back at work and see how it goes.

    How can I learn to write code like you?
    Are there any links or sites you could recommend so I can learn a bit more.

  6. #6
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: VBA (Buttons) To copy and paste into separate sheet

    basic you can learn by recording macro yourself and playing around with that
    that is pretty much how i learned (little bit) with help of this and other forums and some great websites
    Last edited by AC PORTA VIA; 01-15-2020 at 07:07 PM.

  7. #7
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    Thanks again, Ill give this a shot tomorrow.

  8. #8
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    Due to my limited knowledge of VBA would it be possible to set up a sample code so that I can apply it across all sheets?
    Last edited by T.Turner; 01-16-2020 at 05:50 AM.

  9. #9
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: VBA (Buttons) To copy and paste into separate sheet

    Here is macro for each sheet
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    and this is one macro for all
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    Thank you, that works on the main worksheet.

    Is there a bit of code you could add in so that it picks up the workbooks name automatically or so that it didn't need the workbooks name included?
    It get's re saved under a different name once a week every time we do a payment run, so for example it would be 22.01.2020 Bacs and the week after 29.01.2020 Bacs

  11. #11
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: VBA (Buttons) To copy and paste into separate sheet

    If sheet names will be changed use this as long as they are always in the same order- for example basc prepay regardless of date will be always sheet1
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    11-20-2019
    Location
    London
    MS-Off Ver
    Microsoft Office 365 V1910
    Posts
    81

    Re: VBA (Buttons) To copy and paste into separate sheet

    Thank you for taking the time to write all of this and help me understand how VBA coding works.

+ 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 Cell Values based on conditions to separate sheets from primary sheet
    By spyac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2018, 08:04 PM
  2. [SOLVED] Copy and paste a row into a separate sheet if a column's value is greater than 0.
    By ladybug1216 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-24-2015, 09:54 AM
  3. VBA Multi-Column Filter, Copy and Paste on Separate Sheet
    By AMJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2014, 06:33 AM
  4. Copy Values to separate sheet, locate value in list and paste 6 cells to the left
    By drknot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2014, 10:16 AM
  5. VBA: Copy non-blank and paste to separate sheet ONLY blank cells (running list)
    By brolsen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2014, 03:34 PM
  6. copy a range of cells N times and paste in separate sheet and also change a specific colum
    By maramkarthik in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-21-2013, 04:27 AM
  7. Copy/paste macro from one sheet to another assigning buttons
    By noidea28 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 08:44 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