Sorry, read the exam question and check your answer!!
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
dim mymsg as string
if ActiveCell.Address="$A$1" then
mymsg="String 1"
elseif activecell.address="$A$6" then
mymsg="String 2"
else
exit sub
end if
ActiveSheet.Shapes("Text Box").Select
Selection.Characters.Text = mymsg
End Sub
Alan wrote:
This should do what you want but the sub will run EVERY TIME you select
a new cell.
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
dim mymsg as string
if ActiveCell.Address="A1" then
mymsg="String 1"
elseif activecell.address="A6" then
mymsg="String 2"
else
exit sub
end if
msgbox mymsg
End Sub
wrote:
I have on a worksheet a textbox, and i want its contents to change
depending on the highlighted cell.
For example:
when A1 is selected the textbox contents are "msg1"
when A6 is selected the textbox reads "msg2"
Thanks in advance.
Nick