|
- Dim Wy As Range, Df As Range
- Dim i%
- Private Sub cmd保存_Click()
- Wy.Offset(0, Val(ComboBox1.Text) + 1) = Val(TextBox1.Text)
- Df.Offset(0, Val(ComboBox1.Text) + 1) = Val(TextBox2.Text)
- Call ViewShow
- End Sub
- Private Sub ComboBox1_Change()
- On Error Resume Next
- TextBox1.Text = Wy.Offset(0, Val(ComboBox1.Text) + 1)
- TextBox2.Text = Df.Offset(0, Val(ComboBox1.Text) + 1)
- End Sub
- Private Sub ComboBox2_Change()
- Set Wy = Sheet1.Range("A:A").Find(ComboBox2.Text, lookat:=xlWhole)
- Set Df = Sheet2.Range("A:A").Find(ComboBox2.Text, lookat:=xlWhole)
- Call ComboBox1_Change
- Call ViewShow
- End Sub
- Private Sub UserForm_Initialize()
- With ListView1
- .FullRowSelect = True
- .Gridlines = True
- .View = lvwReport
- .MultiSelect = True
- Set .SmallIcons = ImageList1
- .ColumnHeaders.Add , , "月份", 50
- .ListItems.Add , , "物业费"
- .ListItems.Add , , "电费"
- .ListItems.Add , , "合计"
- For i = 1 To 12
- .ColumnHeaders.Add , , i & "月", 30, lvwColumnRight
- ComboBox1.AddItem i & "月"
- Next
- End With
- ComboBox1.ListIndex = Month(Date) - 1
- ComboBox2.List = Sheet1.Range("A4:A119").Value
- End Sub
- Private Sub ViewShow()
- With ListView1
- If Not Wy Is Nothing Then
- For i = 1 To 12
- .ListItems(1).SubItems(i) = Wy.Offset(0, i + 1)
- Next
- End If
- If Not Df Is Nothing Then
- For i = 1 To 12
- .ListItems(2).SubItems(i) = Df.Offset(0, i + 1)
- Next
- End If
- For i = 1 To 12
- .ListItems(3).SubItems(i) = Val(.ListItems(1).SubItems(i)) + Val(.ListItems(2).SubItems(i))
- Next
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|