Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

vba; copy row, paste at offset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
md - 29 Mar 2008 20:10 GMT
I have a row copied to the clipboard, and I want to paste it into
sheetB at rowR, colC.

I can do the paste if I select the entire row, but that's now what I
want.  Thank you.
JLGWhiz - 29 Mar 2008 20:32 GMT
If you copy an entire row, you have to paste an entire row.  You can't put
more into less.  If you want to paste into less space, you need to reduce the
amount you copy to the size (or smaller) of the space you want to paste into.

> I have a row copied to the clipboard, and I want to paste it into
> sheetB at rowR, colC.
>
> I can do the paste if I select the entire row, but that's now what I
> want.  Thank you.
JLGWhiz - 29 Mar 2008 20:44 GMT
To copy only the data in a row you can use something like this:

lstCol = ActiveSheet.SpecialCells(xlCellTypeLastCell).Column
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, lstCol).Copy

If you are using a variable to identify the cursor location, then substitute
that for the ActiveCell.  That will give you a range that is only as long as
the last cell with data in it.  Then you can paste it in a range less than a
full row length.

> I have a row copied to the clipboard, and I want to paste it into
> sheetB at rowR, colC.
>
> I can do the paste if I select the entire row, but that's now what I
> want.  Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.