答案:这个是我做项目时写的,看看是不是你问题中的'初始化表格-
Sub SUBinitGrid_XQJH_WSP()With Me.grdMingxi_WSP
.Cols = 16
.TextMatrix(0, 1) = "序号"
.TextMatrix(0, 2) = "计划号"
.TextMatrix(0, 3) = "企业编码"
.TextMatrix(0, 4) = "品名"
.TextMatrix(0, 5) = "规格"
.TextMatrix(0, 6) = "单位"
.TextMatrix(0, 7) = "单价"
.TextMatrix(0, 8) = "采购数量"
.TextMatrix(0, 9) = "总价"
.TextMatrix(0, 10) = "图号"
.TextMatrix(0, 11) = "分类"
.TextMatrix(0, 12) = "大类"
.TextMatrix(0, 13) = "小类"
.TextMatrix(0, 14) = "计划序号"
.TextMatrix(0, 15) = "计划类型"
.ColWidth(0) = 250
.ColWidth(1) = 450
.ColWidth(2) = 800
.ColWidth(3) = 1000
.ColWidth(4) = 2600
.ColWidth(5) = 1500
.ColWidth(6) = 500
.ColWidth(7) = 700
.ColAlignment(7) = 6
.ColWidth(8) = 800
.ColAlignment(8) = 6
.ColWidth(9) = 800
.ColAlignment(9) = 6
.ColWidth(10) = 800
.ColAlignment(10) = 6
.ColWidth(11) = 1000
.ColWidth(12) = 1500
.ColWidth(13) = 1800
.ColWidth(14) = 800
.ColWidth(15) = 1000
If Val(lblCountNum_WSP.Caption) > 0 Then
Dim i As Integer
Dim WSP_JE As Double
WSP_JE = 0
For i = 1 To .Rows - 1
.TextMatrix(i, 1) = i
If .TextMatrix(i, 3) = "新品申报" Then
.Row = i
.col = 3
.CellForeColor = vbRed
End If
WSP_JE = WSP_JE + Val(.TextMatrix(i, 9))
Me.lblSumWJE.Caption = "总金额:" & Round(WSP_JE, 2) & "元"
Next i
.Row = 1
Else
Me.lblSumWJE.Caption = "总金额:0 元"
End If
End WithEnd Sub