我目前正在尝试通过 Excel 中的选择框在这种情况下选择特定的泵。选择泵时,通过按钮将所选泵的代码放置在单元格中。
在工作表的第 1 列中,通过将名称框值更改为泵代码,单元格已被赋予泵代码作为名称。第 1 列包含 50 个不同的代码。
问题出在:
如果第 1 列中的名称框包含与所选值相同的值,则第 1 列中的单元格加 1。
Private Sub CloseButton_Click()
Unload Me
End Sub
Private Sub Close_button_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim PompGeg(200, 23) As Variant
Dim wb As ThisWorkbook
Set wb = ThisWorkbook
Dim ws As Worksheet
Set ws = wb.Sheets("blad1")
Dim i As Long, rownum As Long
rownum = 1
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) = True Then
ws.Cells(rownum, "e").Value = Me.ListBox1.List(i)
rownum = rownum + 1
Else
End If
Next
Teller = 0
For Teller = 0 To Teller2
If Sheets("blad1").Range("E1").Value = Me.ListBox1.ListIndex Then
Sheets("blad1").Range(PompGeg(Teller, 1)) = Sheets("blad1").Range(PompGeg(Teller, 1)) + 1
End If
Next
End Sub
Private Sub UserForm1()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub