|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Dim i%, j%, arr(), col%, m%
With ListView1
col = .ColumnHeaders.Count 'ListView列数
ReDim arr(1 To .ListItems.Count, 1 To col) '定义数组行数、列数同ListView
For i = 1 To .ListItems.Count '逐行
If .ListItems(i).Checked = True Then '选中
m = m + 1
arr(m, 1) = .ListItems(i)
For j = 1 To col - 1
arr(m, j + 1) = .ListItems(i).SubItems(j)
Next
End If
Next
End With
ThisWorkbook.Sheets(3).[a65536].End(xlUp).Offset(1).Resize(m, col) = arr
如何能表头也导出?这是导到ThisWorkbook.Sheets(3)的,若直接另存iPath = ThisWorkbook.Path & "\"?谢谢! |
|