ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VSTO column insert shift to right (https://www.excelbanter.com/excel-programming/344504-vsto-column-insert-shift-right.html)

Bob Sullentrup

VSTO column insert shift to right
 
Folks,

What's the syntax for inserting a column and shifting cells to the right?

This is close but no cigar:

((Excel.Range)rng.Cells[1,c]).EntireColumn.Insert(Shift.xlRight,Type.Missing);

the Shift.xlRight is incorrect.

--
Bob Sullentrup

Bob Sullentrup

VSTO column insert shift to right
 
Yes, here it is:

Excel.XlInsertShiftDirection.xlShiftToRight

Seek and ye shall find.


--
Bob Sullentrup


"Bob Sullentrup" wrote:

Folks,

What's the syntax for inserting a column and shifting cells to the right?

This is close but no cigar:

((Excel.Range)rng.Cells[1,c]).EntireColumn.Insert(Shift.xlRight,Type.Missing);

the Shift.xlRight is incorrect.

--
Bob Sullentrup


Tom Ogilvy

VSTO column insert shift to right
 
When your inserting an entire column, you don't need to specify the shift
command.


--
Regards,
Tom Ogilvy


"Bob Sullentrup" wrote in message
...
Yes, here it is:

Excel.XlInsertShiftDirection.xlShiftToRight

Seek and ye shall find.


--
Bob Sullentrup


"Bob Sullentrup" wrote:

Folks,

What's the syntax for inserting a column and shifting cells to the

right?

This is close but no cigar:


((Excel.Range)rng.Cells[1,c]).EntireColumn.Insert(Shift.xlRight,Type.Missing
);

the Shift.xlRight is incorrect.

--
Bob Sullentrup





All times are GMT +1. The time now is 04:13 AM.

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