如果单元格名称与单元格值匹配,则值 +1

问题描述

我目前正在尝试通过 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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...