8,737
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private moApp As Excel.Application
Private Sub Command1_Click()
Dim oWB As Excel.Workbook
moApp.Visible = True
Set oWB = moApp.Workbooks.Open("D:\My Documents\Book1.xls")
oWB.Sheets("Sheet1").Rows("2:2").Select
Selection.Insert Shift:=xlDown 'Insert a row at the selection (row 2) and shift all rows below down 1
End Sub
Private Sub Form_Load()
Set moApp = New Excel.Application
End Sub
Excel.Range range = oSheet.get_Range("A1", Type.Missing);
range = range.get_End(Excel.XlDirection.xlDown);
string downAddress = range.get_Address(false, false, XlReferenceStyle.xlA1, Type.Missing, Type.Missing);
range = oSheet.get_Range("A1",downAddress);
object[,] values = (object[,])range.Value2;
for (int i = 2; i < values.GetLength(0); i++)
{
if (values[i-1,1].ToString() == values[i,1].ToString())
{
}