|
楼主 |
发表于 2023-3-8 09:52
|
显示全部楼层
加了Application.ThisWorkbook.Activate,获取的数据貌似可以了,但还是会显示在其它工作簿前,可以再帮忙看看如何调整?谢谢。
Private Sub Userform_Initialize()
On Error Resume Next
Dim i, r
Application.ThisWorkbook.Activate
'设置listview的标题和属性
With Me
.tt0 = ""
With .ListView1
.ColumnHeaders.Add , , "序号", 25, 0
.ColumnHeaders.Add , , "客户名称", 90, 0
.ColumnHeaders.Add , , "介质", 25, 0
.ColumnHeaders.Add , , "储罐资产号", 80, 0
.View = lvwReport
.Gridlines = True
.FullRowSelect = True
.LabelEdit = lvwManual
End With
r = Selection.Row
For i = 1 To Cells(1, Columns.Count).End(xlToLeft).Column
.Controls("tt" & i).Value = ""
.Controls("tt" & i).Value = Cells(r, i).Value
Next
End With
End Sub |
|