Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Jialiang. That helps a lot with my assessment for the customer.
Dale "Jialiang Ge [MSFT]" wrote: Hello Dale, From your post, my understanding on this issue is: you want to know how to dynamically resize the Named Range when new rows are appended to it and how to adjust the named range below the table. If I'm off base, please feel free to let me know. For the first question, Named range will be adjusted automatically if the Insert (row) method is called on cells within it. Suppose we get the Range object of the last row and call its 'Insert' method, we may find that the new row is automatically added into the named range: Excel.Range lastRow = (Excel.Range)name.RefersToRange.Rows[rows.Count, missing]; lastRow.Insert(Excel.XlDirection.xlDown, true); But unfortunately, Excel does not support inserting a row below the caller (such as the 'lastRow' in the above code). The new blank row appears before the 'lastRow'. A possible workaround is to temporarily make the original named range include an extra row beneath the last data row, then call Insert on this extra row. When the datasets are imported, we remove the row from the named range. As FSt1 suggested, another method is to adjust the named range every time when a new row or cell is added by calling NamedRange.RefersToR1C1 = <new range. For the second question, the named ranges below the table will be shifted automatically by Excel when new rows are added to the table. Please let me know if you have any other concerns, or need anything else. Sincerely, Jialiang Ge , remove 'online.') Microsoft Online Community Support ================================================== For MSDN subscribers whose posts are left unanswered, please check this document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. If you are using Outlook Express/Windows Mail, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
auto insert worksheet name in dynamic named range | Excel Programming | |||
Auto-detect range size | Excel Programming | |||
increasing the size of a named range and saving it back to the spreadsheetI | Excel Programming | |||
Cannot Expand Named Range - when size of the Range exceeds | Excel Discussion (Misc queries) | |||
determine range size after auto filter? | Excel Programming |