Evening all!
Am very new to Excel VBA, & need help urgently in the following area (please!). On clicking into a range of cells, need to activate a MsgBox.
Example of this is range A40:A50, within worksheet1.
Example of code under worksheet1 is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheet1.Range(A39, A43) Then
StaffCosts
End If
End Sub
Code will then call a sub/function to display message, assub/function to display message, as per following example:
Sub StaffCosts()
MsgBox "[Message]", vbInformation + vbOKOnly, "[Title of Message to Users]"
End Sub
As mentioned above am very, very new to Excel VBA. Basically I would like to know the Excel equivalent of the appropriate event for the cell ranges upon which to trigger the above message from code, (similar to events on forms within MS Access).
Further note: have successfully managed to manually run the code from the Tools | Macro | Macros...|Run menu.
However I want to trigger the msgbox each time the user selects a value from a drop-down list, and enters this specifically into cells A40 to A50, for example.
Would really appreciate some help with this very soon. Many, many thanks in advance.
Kind regards, - Magnetar![[atom] [atom] [atom]](/data/assets/smilies/atom.gif)
[Ps: Loomah, many thanks for your response earlier today, (which I mistakenly submitted the above in the incorrect forum beforehand!!!).
I did try your suggestion:
if target.address = "$A$40:$A$50" then
call othersub
end if
- but was unable to trigger the MsgBox. Open to any further suggestions/solutions. Many thanks in advance. Magnetar].
Am very new to Excel VBA, & need help urgently in the following area (please!). On clicking into a range of cells, need to activate a MsgBox.
Example of this is range A40:A50, within worksheet1.
Example of code under worksheet1 is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheet1.Range(A39, A43) Then
StaffCosts
End If
End Sub
Code will then call a sub/function to display message, assub/function to display message, as per following example:
Sub StaffCosts()
MsgBox "[Message]", vbInformation + vbOKOnly, "[Title of Message to Users]"
End Sub
As mentioned above am very, very new to Excel VBA. Basically I would like to know the Excel equivalent of the appropriate event for the cell ranges upon which to trigger the above message from code, (similar to events on forms within MS Access).
Further note: have successfully managed to manually run the code from the Tools | Macro | Macros...|Run menu.
However I want to trigger the msgbox each time the user selects a value from a drop-down list, and enters this specifically into cells A40 to A50, for example.
Would really appreciate some help with this very soon. Many, many thanks in advance.
Kind regards, - Magnetar
![[atom] [atom] [atom]](/data/assets/smilies/atom.gif)
[Ps: Loomah, many thanks for your response earlier today, (which I mistakenly submitted the above in the incorrect forum beforehand!!!).
I did try your suggestion:
if target.address = "$A$40:$A$50" then
call othersub
end if
- but was unable to trigger the MsgBox. Open to any further suggestions/solutions. Many thanks in advance. Magnetar].