如果另一个盒子在Excel中具有特定值(VBA)时如何引用msgBox中的单元格。

我试图得到一个相应的单元格input一个msgBox当该行中的单元格击中一定的值。 例如,如果C1> 3.45,我想要一个消息框,说“在+范围(”A1“)+”的值太高“。 这将扩展整个arrays。

我一直在试图修改简单的脚本。

Private Sub Worksheet_Change(ByVal Target As Range) Set Target = Me.Range("C1:C100") If Target.Value > 3.45 Then MsgBox "The Value at "+ Range("A1:A100") + " exceeded limit." End If End Sub 

我知道我错过了一些东西,但我不知道如何关联数字,并让他们返回。 我知道我可以用Match来利用一般forms

  Set targetRange = [range] targetRange.FormulaArray = "=[insert array formula]" 

但我似乎无法让他们正常工作。

预先感谢您的帮助。

为什么不尝试类似的东西

 for i = 1 to 100 if cells(i, 3) > 3.45 then msgbox "Cell C" & i & " is too high. The corresponding time stamp is " & cells(i, 1) & "." end if next i 

这将提醒用户每次在该范围内的一个单元“太高”。

没有循环的单线(有趣 – 触摸更难理解!)

 MsgBox Join(Filter(Application.Transpose(Application.Evaluate("=IF(ISNUMBER(C1:C100),IF(C1:C100>3.45,""C""& ROW(C1:C100),""x""),""x"")")), "x", False), ",")