本文介绍了如何使用.net或vba在excel中使用Range的末尾插入新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我的范围值包含excel表格的使用范围值,现在我无法在范围区域的末尾插入行 静态 public void SpreedsheetOpen( string ExcelFile) { xlApp = new Excel.Application(); xlApp.Visible = false ; xlWorkBook = xlApp.Workbooks.Open(ExcelFile, 0 , true , 5 , , , true ,Microsoft.Office.Interop.Excel.XlPlatform。 xlWindows, \t, false , false , 0 , true , 1 , 0 ); xlWorkSheet =(Excel.Worksheet)xlWorkBook.Worksheets.get_Item( 1 ); xlRange = xlWorkSheet.UsedRange; } 此xlRange = xlWorkSheet.UsedRange中的;我得到了xl表在范围对象中使用的范围值如何在此范围的末尾插入新行。解决方案 首先,没有必要添加/插入新行,因为已存在一组行和列!您所要做的就是找到第一个空行,如 Keneth Haugland [ ^ ]在问题的评论中提到 I have the range value that contains used range values of excel sheet, now I cant insert row at end of the range areastatic public void SpreedsheetOpen(string ExcelFile) { xlApp = new Excel.Application(); xlApp.Visible = false; xlWorkBook = xlApp.Workbooks.Open(ExcelFile, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); xlRange = xlWorkSheet.UsedRange; }in this xlRange=xlWorkSheet.UsedRange; I get the xl sheet used range value in range object how to insert new row at end of this range. 解决方案 First of all, there is no need to add/insert new row, because a set of rows and columns already exists! All you have to do is to find first blank row, as Keneth Haugland[^] mentioned in the comment to the question. 这篇关于如何使用.net或vba在excel中使用Range的末尾插入新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 18:15