|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
下面是代码 运行到蓝字部分 提示溢出
Private Sub UserForm_Initialize()
Dim r%, i%
Dim arr, brr
Dim itm As ListItem
Dim d2 As Object
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
Set d3 = CreateObject("scripting.dictionary")
Set d4 = CreateObject("scripting.dictionary")
With Worksheets("发货账单")
r = .Cells(.Rows.Count, 1).End(xlUp).Row
arr = .Range("a2:f" & r)
For i = 1 To UBound(arr)
d1(arr(i, 1)) = ""
d2(arr(i, 4)) = ""
d3(arr(i, 5)) = ""
d4(arr(i, 6)) = ""
Next
End With
With Worksheets("客户信息")
r = .Cells(.Rows.Count, 1).End(xlUp).Row
arr = .Range("a1:b" & r)
For i = 1 To UBound(arr)
If d1.exists(arr(i, 1)) Then
d1(arr(i, 1)) = arr(i, 2)
End If
Next
End With
With 发货统计
.Caption = " 欢迎使用查询统计系统!今天是:" & Format(Date, "yyyy年mm月dd日")
.ComboBox1.List = d1.keys
.ComboBox2.List = d2.keys
.ComboBox3.List = d3.keys
.ComboBox4.List = d4.keys
With .ListView1
lk = .Width
.View = lvwReport
.Gridlines = True
.FullRowSelect = True
.HotTracking = True
.OLEDragMode = 1
.ColumnHeaders.Clear
.ListItems.Clear
With .ColumnHeaders
.Add 1, , Sheets("发货账单").Cells(1, 1), lk / 7
.Add 2, , Sheets("发货账单").Cells(1, 2), lk / 6, lvwColumnCenter
.Add 3, , Sheets("发货账单").Cells(1, 3), lk / 8, lvwColumnCenter
.Add 4, , Sheets("发货账单").Cells(1, 4), lk / 8, lvwColumnCenter
.Add 5, , Sheets("发货账单").Cells(1, 5), lk / 8, lvwColumnCenter
.Add 6, , Sheets("发货账单").Cells(1, 6), lk / 6, lvwColumnCenter
.Add 7, , Sheets("发货账单").Cells(1, 7), lk / 8, lvwColumnCenter
End With
End With
End With
End Sub
|
|