+ Reply to Thread
Results 1 to 5 of 5

VBA-Copy selected cells and paste under table on another sheet

  1. #1
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    VBA-Copy selected cells and paste under table on another sheet

    Hello everyone,

    I'm struggling to get this code working. What I am trying to do is create an Input box for the user to select data from two cells, then copy this data and paste it to another sheet that contains a table. I need it to paste directly below the table so it expands and captures the information. Please see what I have so far, below. The code stops at the .range ("x) line.

    Any help would be greatly appreciated!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA-Copy selected cells and paste under table on another sheet

    Hi, you don't past under a table you insert into the table after the final row.
    I suggest your read this article, it's long but it explains everything about using tables and addressing tables in Excel with VBA
    I can come up with many solutions, but if you take the time you'll see it's not that difficult, it's just the way you approach a real table as listobject
    https://www.thespreadsheetguru.com/b...t-excel-tables

    After that ... I'll gladly help you on
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Re: VBA-Copy selected cells and paste under table on another sheet

    Super good read. Appreciate the link! After reading thru I see how I asked the wrong question and stumbled across something that could potentially be more effective. I didnt realize you could insert into a certain row. How would I structure this code to insert into the first row? The secondary Item I haven't worked on is the password unlock and lock when finished. Do you think thats possible? Their are columns on the table that need to stay protected.

    Basically I'm copying 2 cells that the user selects and inserting them into the first two columns on a table in another sheet.

  4. #4
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Re: VBA-Copy selected cells and paste under table on another sheet

    Below is what I am slowly coming up with, missing component is how do I get it to paste in to the range? I've tried a few variations and it isn't working.
    The other issue is its locking the selected cells after. I want to lock the sheet but have those cells remain unlocked. I'm guessing someone has a
    way better option than my code. Newbie here....

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA-Copy selected cells and paste under table on another sheet

    What you need to so is specify the raneg of cells that remains unlocked before you protect the worksheet.
    You can do this manually, select those cells that will not be locked and the protect the worksheet allowing only the unlocked cells to be selected.
    You can do this once manually using the same password as you have in the code then when the van code protects it it remains that wya.
    Add the following parameter to the protect this will permit VBA code to edit ANY cell without needing to unprotect the sheet when using vba.

    Please Login or Register  to view this content.
    Hope this points you in the right direction

+ 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. VBA formula to copy paste selected data from main sheet to new sheet
    By vbanoob123 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-24-2014, 12:28 PM
  2. [SOLVED] Macro to copy and paste selected cell to a table.
    By JohnDoh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2013, 03:13 AM
  3. Copy selected cells from a range of worksheets and paste in master table
    By simba3088 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-20-2012, 07:59 AM
  4. copy paste data with multiple selected ranges from sheet to sheet
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2011, 02:45 PM
  5. copy paste selected range from one sheet to another
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-10-2011, 06:57 AM
  6. copy data from selected cells , in selected row and paste it to ms word table ?
    By aaashaaa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2010, 03:25 PM
  7. How do I copy selected cells in excel and paste into word table
    By REVA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2006, 05:45 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