+ Reply to Thread
Results 1 to 7 of 7

cut cells and paste to table on separate worksheet/table on button click

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    cut cells and paste to table on separate worksheet/table on button click

    I am trying to create a macro that will cut predefined cells and paste them into the next available line in a table. I tried recording, but i cant quite mimic select the last line available. I also tried looking at the many threads on it, but i cant synthesize it for my needs.

    I would also like to copy the columns under this table and then paste them into a pivot table on the same worksheet as the other table. Any help would be appreciated...

    I know how to assign the macro to the button, its just the macro itself that i cant create... Im surprised im having so much trouble with this after playing microcontrollers for the past few months. I thought id be able to figure this out... oh well. thanks for any help.

    batch worksheet.xls

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: cut cells and paste to table on separate worksheet/table on button click

    One way to find the last data row is
    Please Login or Register  to view this content.
    That's assuming there is always data in column A. If not, use a column where every row will have data.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: cut cells and paste to table on separate worksheet/table on button click

    Quote Originally Posted by natefarm View Post
    One way to find the last data row is
    Please Login or Register  to view this content.
    That's assuming there is always data in column A. If not, use a column where every row will have data.
    The "+1" would give the first empty row, not the last data row?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: cut cells and paste to table on separate worksheet/table on button click

    Yes. The .End method is the same thing as pressing Ctrl+arrow (with arrow being one of the arrow keys), so .End(xlup) is the same as Ctrl+up arrow. Rows.count puts you at the maximum spreadsheet row, up-arrow puts you at the first data found in the up direction, and plus 1 puts you in the next available row. Same could be done to find the first available column using columns.count and .End(xlToLeft) + 1.

    Using the macro recorder is a great way to find code that does what you need, but don't get hung up on the results. Recording exact keystrokes produces a lot of unnecessary code, such as selecting cells or ranges, scrolling, switching tabs, etc. Rarely is the .Select method needed in final code.

  5. #5
    Registered User
    Join Date
    08-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: cut cells and paste to table on separate worksheet/table on button click

    Please Login or Register  to view this content.
    just seems to paste the cells wherever i last left the cursor on that page? I have a table with headers, and then some more description cells above that. Should i get rid of the description cells (but id like to keep the header)?

  6. #6
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: cut cells and paste to table on separate worksheet/table on button click

    Well, that's exactly what you're telling it to do with Activesheet.Paste. You obtained the endrw value, but didn't use it.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: cut cells and paste to table on separate worksheet/table on button click

    Maybe:

    Please Login or Register  to view this content.

+ 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. automatically fill a table when i click a button
    By netha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-06-2013, 08:22 AM
  2. Cut & paste selected cells, by pressing button, to first blank row in table
    By Ejb123erok in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-30-2013, 08:11 AM
  3. [SOLVED] How to show a sum of conditional cells from table A in a separate Table?
    By jjin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-27-2012, 09:52 AM
  4. Populate an Excel Form from a table on push button click
    By munzer1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2007, 09:55 PM
  5. [SOLVED] Right Click Pivot table -> Wizard -> Back button is disable
    By Ashok in forum Excel General
    Replies: 0
    Last Post: 11-16-2005, 06:15 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