|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Dim I, K As Integer
Dim ARR
ReDim ARR(1 To 1000, 4)
Dim ITM As ListItem
I = 1
For j = 1 To Worksheets("生产预定").Range("C65535").End(3).Row
If Worksheets("生产预定").Cells(j, 6) = Cells(1, ActiveCell.Column) Then
ARR(I, 1) = Worksheets("生产预定").Cells(j, 1)
ARR(I, 2) = Worksheets("生产预定").Cells(j, 3)
ARR(I, 3) = Worksheets("生产预定").Cells(j, 4)
ARR(I, 4) = Worksheets("生产预定").Cells(j, 5)
I = I + 1
End If
Next j
lv1.ColumnHeaders.Clear
lv1.ListItems.Clear
With lv1
.Gridlines = True '显示网格线
.FullRowSelect = True '整行选择
'.MultiSelect = True '多选
.LabelEdit = lvwManual '第一列手动修改。不然点两下鼠标就进入编辑状态
'.CheckBoxes = True '显示复选框
.View = lvwReport '报表视图
.Font.Size = 12 '设置字号为四号
.ColumnHeaders.Add , , "ST_DATE", lv1.Width / 5 '添加标题,并设置宽度为 100。
.ColumnHeaders.Add , , "生产批号", lv1.Width / 4
.ColumnHeaders.Add , , "型号", lv1.Width / 4
.ColumnHeaders.Add , , "工单号", lv1.Width / 4
End With
For j = 1 To I - 1
lv1.ListItems.Add.Text = ARR(j, 1)
lv1.ListItems.Add.SubItems(1) = ARR(j, 2)
lv1.ListItems.Add.SubItems(2) = ARR(j, 3)
lv1.ListItems.Add.SubItems(3) = ARR(j, 4)
Next j |
|