Private Sub CommandButton1_Click()
On Error Resume Next
With Sheets("Sheet1")
10: If TextBox1 <> "" And TextBox2 <> "" Then
.Cells(.[a65536].End(3).Row + 1, 1) = TextBox1.Text
.Cells(.[a65536].End(3).Row, 2) = TextBox2.Text
Else
MsgBox "请输入完整的资料"
GoTo 10
End If
.Range("C2:C" & .[a65536].End(3).Row).Clear
For i = 2 To .[a65536].End(3).Row
.Cells(i, 3) = Application.WorksheetFunction.Rank(.Cells(i, 2), .Range("B2:B" & .[a65536].End(3).Row), 1) + (i - 1 Mod 10) * 0.01
.Cells(i, 4) = i - 1
Next
End With
TextBox1 = "": TextBox2 = ""
Call paixv
End Sub
Private Sub UserForm_Initialize()
On Error Resume Next
With Sheets("Sheet1")
.Range("C2:D" & .[a65536].End(3).Row).Clear
For i = 2 To .[a65536].End(3).Row
.Cells(i, 3) = Application.WorksheetFunction.Rank(.Cells(i, 2), .Range("B2:B" & .[a65536].End(3).Row), 1) + (i - 1 Mod 10) * 0.01
.Cells(i, 4) = i - 1
Next
End With
TextBox1 = "": TextBox2 = ""
Call paixv
End Sub
Sub paixv()
On Error Resume Next
Dim itm1, itm2 As ListItem, list1, list2
ListView1.ListItems.Clear
ListView2.ListItems.Clear
With Sheets("Sheet1")
ListView1.ColumnHeaders.Add 1, "S1", "数据", ListView1.Width / 2
ListView1.ColumnHeaders.Add 2, "Z1", "数值", ListView1.Width / 2, lvwColumnRight
ListView1.View = lvwReport
ListView1.Gridlines = True
For i = 2 To .[a65536].End(3).Row
aa = .Range("c2:c" & .[a65536].End(3).Row).Find(Application.Large(.Range("c2:c" & .[a65536].End(3).Row), i - 1)).Offset(0, 1).Value
Set list1 = ListView1.ListItems.Add(Text:=.Cells(aa + 1, 1))
Set li1 = list1.ListSubItems.Add(Text:=.Cells(aa + 1, 2))
Next i
ListView2.ColumnHeaders.Add 1, "S2", "数据", ListView2.Width / 2
ListView2.ColumnHeaders.Add 2, "Z2", "数值", ListView2.Width / 2, lvwColumnRight
ListView2.View = lvwReport
ListView2.Gridlines = True
For j = 2 To .[a65536].End(3).Row
ab = .Range("c2:c" & .[a65536].End(3).Row).Find(Application.Small(.Range("c2:c" & .[a65536].End(3).Row), j - 1)).Offset(0, 1).Value
Set list2 = ListView2.ListItems.Add(Text:=.Cells(ab + 1, 1))
Set li2 = list2.ListSubItems.Add(Text:=.Cells(ab + 1, 2))
Next j
End With
End Sub
Sub sdsds()
UserForm1.Show
End Sub
因为比较赶所以马虎的做了下。代码可以优化但是没有,你看是不是这种类型?