excel vba listview引用单元格问题
excelvbalistview引用单元格问题单元格是个时间,引用到listview里就变数字了,怎么办?...
excel vba listview引用单元格问题单元格是个时间,引用到listview里就变数字了,怎么办?
展开
2个回答
展开全部
Private Sub UserForm_Initialize()
Dim tb As Table, x%, y%
Set tb = ThisDocument.Tables(1)
x = tb.Rows.Count
y = tb.Columns.Count
ListView1.ColumnHeaders.Add , , "序号", 40
For n = 1 To y
ListView1.ColumnHeaders.Add , , tb.Rows(1).Cells(n).Range.Text, 40
Next
For i = 1 To x
ListView1.ListItems.Add , , i
For j = 1 To y
ListView1.ListItems(i).SubItems(j) = Left(tb.Cell(i + 1, j).Range.Text, Len(tb.Cell(i + 1, j).Range.Text) - 1)
Next j
Next i
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.Gridlines = True
End Sub
Dim tb As Table, x%, y%
Set tb = ThisDocument.Tables(1)
x = tb.Rows.Count
y = tb.Columns.Count
ListView1.ColumnHeaders.Add , , "序号", 40
For n = 1 To y
ListView1.ColumnHeaders.Add , , tb.Rows(1).Cells(n).Range.Text, 40
Next
For i = 1 To x
ListView1.ListItems.Add , , i
For j = 1 To y
ListView1.ListItems(i).SubItems(j) = Left(tb.Cell(i + 1, j).Range.Text, Len(tb.Cell(i + 1, j).Range.Text) - 1)
Next j
Next i
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.Gridlines = True
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |