ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tuition on 'copyorigin' (https://www.excelbanter.com/excel-programming/396098-tuition-copyorigin.html)

JillC

Tuition on 'copyorigin'
 
Please can someone tell me what this is used for with the Insert method. I
was hoping to be able to copy the contents of a row, and insert it below the
source row using this facility.
--
Thanks in advance, Jill C

Bernie Deitrick

Tuition on 'copyorigin'
 
Jill,

CopyOrigin isn't the range that should be copied prior to insertion, if that is what you were
thinking.

CopyOrigin takes one of two named constants to determine what format the inserted cell should have:

xlFormatFromLeftOrAbove

or

xlFormatFromRightOrBelow

To do what you want, simply use

Rows(1).Copy
Rows(2).Insert

will copy row 1 and insert it above the existing row 2.

HTH,
Bernie
MS Excel MVP


"jillc" wrote in message
...
Please can someone tell me what this is used for with the Insert method. I
was hoping to be able to copy the contents of a row, and insert it below the
source row using this facility.
--
Thanks in advance, Jill C





All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com