在表的末尾添加“somme”一词

时间:2015-03-09 22:06:34

标签: vb.net excel

这是我的代码:

     xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    xlApp.Visible = True


    Dim j As Integer
    Dim lastrow As Integer
    Dim lastcol As Integer


    With xlWorkSheet
        .Select()
        j = xlApp.Cells.SpecialCells(2).Column
        lastrow=xlApp.Cells.SpecialCells(2).Rows.End(XlDirection.xlDown).Row                                              
         lastcol = xlApp.Cells.SpecialCells(2).Columns.End(XlDirection.xlToRight).Column
        For thiscol = j To lastcol
            .Cells(lastrow + 1, thiscol).Value = _
            xlApp.Sum(.Range(.Cells(1, thiscol), .Cells(lastrow, thiscol)))
        Next
    End With

我想在表格的末尾添加“sum”这个词 当我找到表的末尾时,我插入“sum”一词

1 个答案:

答案 0 :(得分:0)

next', and before结束后,添加一行,如:

.cells(lastRow + 2, 1).value = "Somme"

这将是" Somme"在第一列中的最后一行数据之后。