你的代码中,Count没有赋值,默认等于0,count -1等于-1,所以出现了你说的错误。 取得某个表最后一行: with DataTables("原料辅材") dr1 = .DataRows(.DataRows.count-1)End With