View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Another way with cell comments.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$7" Then
MsgBox Title:="Definition", Prompt:="The name of the measure.", _
Buttons:=vbOKOnly
End If
End Sub

worked fine for me. For multiple cells, you could do

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$7" Then
MsgBox Title:="Definition", Prompt:="The name of the measure.", _
Buttons:=vbOKOnly
ElseIf Target.Address = "$B$8" then
MsgBox Title:="Something", Prompt:="Something else.", _
Buttons:=vbOKOnly
ElseIf Target.Address = "$C$5" Then
MsgBox Title:="Something1", Prompt:="Something else1.", _
Buttons:=vbOKOnly
End If
End Sub

This could also be done with a case statement

Case Target.Address
Case "$B$7"

Case "$B$8"

Case "$C$5"

End Select

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Hi Tom,

Thanks for your reply. Here are the two Subs for this worksheet. The

first
works okay, but the MsgBox Sub does not. Where am I wrong? Also, to add

the
MsgBox code for other cells, do I simply copy the code (like for B7) and
change the cell address and MsgBox prompt...?

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
' When user updates percentage in cell AV17, todays date (NOW)
' is automatically populated into cell AV18.
If Target.Address = "$AV$21" Then
Application.EnableEvents = False
Range("AV22").Value = Format$(Now, "mm/dd/yy")
Errorhandler:
Application.EnableEvents = True
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$7" Then
Application.EnableEvents = False
MsgBox Title:="Definition", Prompt:="The name of the measure.", _
Buttons:=vbOKOnly
Errorhandler:
Application.EnableEvents = True
End If
End Sub

"Tom Ogilvy" wrote:

Possibly using the selectionchange event.

would this system work when the cell is locked and protection invoked?

if you allowed the user to select locked cells.

http://www.cpearson.com/excel/events.htm

for information on events.

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
One problem with complex (very numerous cells) with comments is that

as
the
user moves the cursor through the worksheet, comments keep popping

up -
can
be quite an annoyance. Is there another way? - user clicks on a cell,

box
comes up on screen with text, user clicks in the text box and text

box
disappears. The click cells are not data cells, only title cells.

Also,
would this system work when the cell is locked and protection invoked?

For example: merged cell range B7, user clicks cell B7, text box comes

up
with text: "Person Responsible", user clicks somewhere in the text box

and
it
disappears.