如果未选中复选框,我们如何显示相邻单元格值的值?

时间:2016-07-14 20:33:38

标签: excel-vba vba excel

我是VBA Macro的新手。提交项目时需要遵循一系列步骤,每个步骤在相邻单元格中都有一个复选框。如果未选中复选框,我想显示该值。我没有写过任何代码。我是新来的。需要帮助。

enter image description here 是的,我想使用消息框,在单击快照中显示的提交按钮后显示未选中单元格的值。

我写了这个模块,但它冗长。

Sub AllChecked()

    If Range("d3").Value = 18 Then
        MsgBox "Project ready for upload"
    End If
    If Range("c3").Value = False Then
        MsgBox "Please review the cover sheet"
    End If
    If Range("c4").Value = False Then
        MsgBox "Please review the processor's notes"
    End If
    If Range("c5").Value = False Then
        MsgBox "Please Review the project map"
    End If
    If Range("c6").Value = False Then
        MsgBox "Please Check the orientation"
    End If
    If Range("c7").Value = False Then
        MsgBox "Please Check for missing data"
    End If
    If Range("c8").Value = False Then
        MsgBox "Please Check for illegal movements"
    End If
    If Range("c9").Value = False Then
        MsgBox "Analyze the data in 2 to 3-hour increments as well as 15-minute increments"
    End If
    If Range("c10").Value = False Then
        MsgBox "Please check the date of collection"
    End If
    If Range("c11").Value = False Then
        MsgBox "Please Check for abnormal peaks or valleys in the datasets"
    End If
    If Range("c12").Value = False Then
        MsgBox "Please give spot checks if necessary"
    End If
    If Range("c13").Value = False Then
        MsgBox "Make small adjustments if necessary"
    End If
    If Range("c14").Value = False Then
        MsgBox "Please checking historical data if it exists"
    End If
    If Range("c15").Value = False Then
        MsgBox "Please Check for the diffrent templets as per the project series"
    End If
    If Range("c16").Value = False Then
        MsgBox "Please Make note for extra leg (include/exclude)"
    End If
    If Range("c17").Value = False Then
        MsgBox "Before removing the side walk from peds count check the rotation and coversheet if client required or not"
    End If
    If Range("c18").Value = False Then
        MsgBox "Sketches? (Always for the 3000 jobs,some with requested Project)(review the processer sketches)"
    End If
    If Range("c19").Value = False Then
        MsgBox "Check for data patterns in the datasets  for two successive intervals having same total volume and each movement has similarities etc"
    End If
    If Range("c20").Value = False Then
        MsgBox "Check for data patterns in the datasets  for two successive intervals having same total volume and each movement has similarities etc"
    End If

End Sub

1 个答案:

答案 0 :(得分:1)

您可以循环p.__handler__ // returns handler object -> Object {get: handler.get(), set: handler.set(), ...} p.__handler__.get // returns get prop/fn of handler -> function(target, name){ ...} 测试值并构建消息。这样,您只有一个Msgbox。

Range("C3:C20")