Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VSTO: insert one row into a 1-row range
I have a programming written in C#, trying to insert a new row into a
range. If the range has two rows or more than two rows, all work just fine. However, if the range only has one row, the insert doesn't work quite right. The insert seems working (visually the worksheet has one more row), but the range is not updated. The code looks like the following: NamedRange nr = Controls.AddNamedRange("A1", Type.Missing); Range r = nr.Cells[1,1].EntireRow; r.Insert(XlInsertShiftDirection.xlShiftDown, Type.Missing); After above code, I would expect that the namedrange nr has two rows. But it still has one row even a new row is actually insert into worksheet. However, if the namedrange has two rows or more, after executing above codes, nr.Rows.Count will be incremented. What can be wrong in my code? Does it mean NamedRange doesn't work for 1 row range? Thanks for reading and help! JJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formulas assignment from array to range in VSTO Excel doesn't work | Excel Worksheet Functions | |||
VBA and VSTO | Excel Programming | |||
VSTO | Excel Discussion (Misc queries) | |||
VSTO column insert shift to right | Excel Programming | |||
VSTO 2.0 | Excel Programming |