View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Cell Change activating macro. How do you make it happen?

John,

The problem is most likely the comparison with the address: by default, VBA
does case sensitive comparisons, and Address will return $F$5 and your code
has $f$5. At the very top of the code module, before any procedure or
declaration, include

Option Compare Text


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"John Baker" wrote in message
...
Tom:

Thanks for the advice.

The following is exactly what I pasted into the worksheet code sheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = "$f$5" Then
Msg box "Do something "
End If
End Sub

However, nothing happens when I change the contents of F5 and press enter!

When I change
the cell contents, press enter, leave the cell, and then later return and

click on it the
"DO SOMETHING" box activates.

Is this the way its supposed to happen?


"Tom Ogilvy" wrote:

It is event code

Right click on the worksheet tab where you want this behavior. Select

View
code.

Paste in the code.