Dear all,
I would like to get your help with constructing my module. The idea of the module is that when a certain condition is satisfied a message box appears. This messagebox needs to display the name of the sheet, the content (value) of the cell that triggered the messagebox and the content of the cell that is located 3 columns to the left of the trigger cell.
Ideally I would like the message box to display the following:
"Ticker: (Name of the sheet). ABCDEFGH in the ... (...1= cell 3 columns to the left of target cell that triggers message box) is ... (...2 = content of cell that triggers message box) ABCDEF."
So far, the code of the message box looks like this:
How do include the cell that is located 3 columns to the left of the target cell in the messagebox?
Thank you very much
I would like to get your help with constructing my module. The idea of the module is that when a certain condition is satisfied a message box appears. This messagebox needs to display the name of the sheet, the content (value) of the cell that triggered the messagebox and the content of the cell that is located 3 columns to the left of the trigger cell.
Code:
Sub Workbook_SheetCalculate(ByVal Sh As Object)Dim myRange As Range
Dim myArray as Variant
Set myRange As Sh.Range("N1:N50,AA1:AA50,AN1:AN50,BA1:BA50,BN1:BN50,CA1:CA50")
myArray = myRange.Cells
Dim product as Double
product = Sh.Range("A1").Value * Sh.Range("A2").Value
Dim n As Long
For n = 1 To Ubound (myArray)
If myArray(n,1) > product Then
MsgBox ...
Ideally I would like the message box to display the following:
"Ticker: (Name of the sheet). ABCDEFGH in the ... (...1= cell 3 columns to the left of target cell that triggers message box) is ... (...2 = content of cell that triggers message box) ABCDEF."
So far, the code of the message box looks like this:
Code:
MsgBox "Ticker: " & Sh.Name & " . ABCDEFGH in the " & ...1 & "is " &myRange.Cells(n).Address & " ABCDEF."
How do include the cell that is located 3 columns to the left of the target cell in the messagebox?
Thank you very much