LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Another way with cell comments.

Yes! It works on the merged cell range. Thanks, Tom - appreciate your time.
Phil

"Tom Ogilvy" wrote:

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

Should work regardless of whether merged or not.


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Yes it doew work! B7 is a merged cell range - mentioned in my opening

post.
When I unmerged it and clicked on B7 the msgbox came up. Should there be

a
dim line? How to reference it in the code lines?

"Tom Ogilvy" wrote:

worked fine for me.

This as well:
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

Which was copied right out of the email and pasted into the sheet

module.

Perhaps you have events disabled. To aid in debugging your problem, you

can
put this in a general module and call it from the tools = Macros menu

Public Sub TurnOnEvents()
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Tom, Would you clarify something for me, when the user clicks on B7,

the
message box should come up??? I have this code in the VBA sheet for

the
worksheet it operates in. For some reason it is not working. Thanks,
Phil

"Tom Ogilvy" wrote:

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.















 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Cell Comments and Paste as text in a cell Goaliemenace Excel Worksheet Functions 3 October 19th 09 10:28 PM
excel 2000 how to format the comments font all comments Delquestion Excel Discussion (Misc queries) 1 October 8th 09 02:19 PM
print comments using cell contents, not cell# dickenswick Excel Discussion (Misc queries) 3 September 20th 06 11:48 PM
Need to add cell comments in unlocked cell on protected worksheet dan400man Excel Discussion (Misc queries) 3 December 16th 05 08:02 PM
cell comments ben Excel Programming 0 January 27th 05 09:29 PM


All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"