Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formulas assignment from array to range in VSTO Excel doesn't work vsto excel array to range Excel Worksheet Functions 0 December 11th 07 04:48 PM
VBA and VSTO Jos Vens[_2_] Excel Programming 14 April 11th 06 11:03 AM
VSTO David12345 Excel Discussion (Misc queries) 2 December 27th 05 08:14 PM
VSTO column insert shift to right Bob Sullentrup Excel Programming 2 November 2nd 05 08:05 PM
VSTO 2.0 No Name Excel Programming 1 December 8th 03 09:02 PM


All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"