Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to write a macro to copy a selected amount of data and
paste it onto the next avaliable row. However the worksheet is continually expanding and it will not always go in the same row. Is there a way to write the marco to paste the copied data? I already know how to write the macro to copy all the cells but I just need to know how to tell it to paste into the growing spreadsheet. Thank you, Ryan --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
and paste it onto the next avaliable row.
It would help people to help you if you explained what you mean here. An example perhaps. -- Jim Rech Excel MVP |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I understood you, this should work. Make sure you have
something in the clipboard or it will error out. Not sure how to check for that without using api. Private Sub CommandButton1_Click() ' Grab the current worksheet. Dim shtCurrent As Worksheet Set shtCurrent = ActiveSheet ' Identify the last used row. Dim rngLastRow As Range Set rngLastRow = shtCurrent.UsedRange.Rows (shtCurrent.UsedRange.Rows.Count) ' Find the first cell in the last used row. Dim rngLastCell As Range Set rngLastCell = rngLastRow.Cells(1, 1) ' Increment down one row to identify the target paste cell. Dim rngPasteTarget As Range Set rngPasteTarget = rngLastCell.Offset(1, 0) ' Paste it. rngPasteTarget.PasteSpecial End Sub HTH. -----Original Message----- I would like to write a macro to copy a selected amount of data and paste it onto the next avaliable row. However the worksheet is continually expanding and it will not always go in the same row. Is there a way to write the marco to paste the copied data? I already know how to write the macro to copy all the cells but I just need to know how to tell it to paste into the growing spreadsheet. Thank you, Ryan --- Message posted from http://www.ExcelForum.com/ . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If column A of the destination sheet will always have data in it
worksheets("DestSheetName").Cells(rows.count,1).En d(xlup)(2).Paste -- Regards, Tom Ogilvy rglasunow wrote in message ... I would like to write a macro to copy a selected amount of data and paste it onto the next avaliable row. However the worksheet is continually expanding and it will not always go in the same row. Is there a way to write the marco to paste the copied data? I already know how to write the macro to copy all the cells but I just need to know how to tell it to paste into the growing spreadsheet. Thank you, Ryan --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert copied cells | Excel Worksheet Functions | |||
Insert Copied Cells? | Excel Discussion (Misc queries) | |||
Excel - Insert Copied Cells | Excel Discussion (Misc queries) | |||
insert copied cells | Excel Discussion (Misc queries) | |||
Copy row, Insert>Copied>Cells crashes Excel | Excel Discussion (Misc queries) |