我想计算SUM
这是我的代码:
Dim lastrow As Integer
Dim lastcol As Integer, thiscol As Integer = CInt(j)
xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text),Excel.Worksheet)
xlWorkSheet.Activate()
xlApp.Visible = True
With xlWorkSheet
xlWorkSheet.Select()
j = (xlApp.Cells.SpecialCells(2).Row + 1 & vbCrLf&xlApp.Cells.SpecialCells(2).Column)
lastrow = .Cells(.Rows.Count, 1).End(Excel.XlDirection.xlUp).Row
lastcol = .Cells(1, .Columns.Count).End(Excel.XlDirection.xlToLeft).Column
For thiscol = j To lastcol
.Cells(lastrow + 1, thiscol).Value = _
xlApp.Sum(.Range(.Cells(1, thiscol), .Cells(lastrow, thiscol)))
Next
End With
我想使用变量' j'整数而不是字符串。