【问题标题】:Using different multiple check boxes to write to the same cell使用不同的多个复选框写入同一个单元格
【发布时间】:2020-09-02 17:09:54
【问题描述】:

我试图让不同的多个复选框写入同一个单元格而不覆盖以前的信息。

If CheckBox13.Value = True _
    Then
    Range("A1").Value = "True 1"
End If

If CheckBox14.Value = True _
    Then
    Range("A1").Value = Range ("A1").Value + "True 2"
End If

看起来准确吗?

【问题讨论】:

    标签: excel vba checkbox userform


    【解决方案1】:

    利用控件的默认属性,您可以使用如下内容:

    Range("A1") = ""
    
    If CheckBox1 Then Range("A1") = "True 1"
    If CheckBox2 Then Range("A1") = Range("A1") + ", True 2"
    If CheckBox3 Then Range("A1") = Range("A1") + ", True 3"
    If CheckBox4 Then Range("A1") = Range("A1") + ", True 4"
    
    If (Range("A1") <> "") And (Left(Range("A1"), 1) = ",") Then
      Range("A1") = Mid(Range("A1"), 3)
    End If
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-01
      • 2013-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多