View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Worksheet _Calculate event handler_how to use

Darin,

Do you have Excel97 by any chance? Excel 97 doesn't detect achange in a
drop-down list.

What you need to do is link a cell to E4 (=E4), and use the
Worksheet_Calculate event to text the activecell (which will still be E4)

Private Sub Worksheet_Calculate()
Dropdown_Change ActiveCell
End Sub

Private Sub Dropdown_Change(ByVal Target As Excel.Range)

Sheets("Answers").Select

If Target.Address = "$E$4" Then
Application.EnableEvents = False
If Target.Value = "No" Then
Call FAS_Hide
End If

If Target.Value = "FAS" Then
Call FAS_Unhide

Application.EnableEvents = True
End If
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Darin Kramer" wrote in message
...
Here is the problem...

User selects from a drop down validation box an option (say option 1)

This displays a word(FAS in this example) in another Cell, say in E4.
I want an EVENT to run if cell E4 has a value - so if E4 has the value
"FAS," I want to call a Macro called FAS_UNhide. If E4 has ANY OTHER
VALUE (using a simple IF I can make this other value a NO), then I
want it to run another MACRO (called FAS_hide)

Using the Code as reflected below nothing happens UNTIL I MANUALLY GO
INTO CELL (E4) and press F2(ie function key 2). I need the event to run
when the cell contents are changed.... - NOW I THINK THE PROBLEM IS
BECAUSE I NEED TO USE THE worksheet_calculate event handler - BUT I
DONT KNOW HOW TO..... WHAT NEEDS changin BELOW...?
I would greatly appreciate any help


Attached code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Sheets("Answers").Select

If Target.Address = "$E$4" Then
Application.EnableEvents = False
If Target.Value = "No" Then
Call FAS_Hide
End If

If Target.Value = "FAS" Then
Call FAS_Unhide

Application.EnableEvents = True
End If
End If
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!