LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Worksheet Change event

I have a problem with some sheet code, I think I know what is causing the
problem but I cannot figure a solution. This is the code that causes the
error:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$D$7" And Target.Value = "option 1" Then
Range("A8:A11").EntireRow.Hidden = False
Range("D8").Value = "H"
ElseIf Target.Address = "$D$7" And Target.Value = "option 2" Then
Range("A8:A11").EntireRow.Hidden = False
Range("D8").Value = "M"
ElseIf Target.Address = "$D$7" And Target.Value = "option 3" Then
Range("A8:A11").EntireRow.Hidden = False
Range("D8").Value = "L"
ElseIf Target.Address = "$D$7" And IsEmpty(Target.Value) Then
Range("A8:A11").EntireRow.Hidden = True
Range("D8").ClearContents
End If
End Sub

D7 is really D7:G7 but the option 1, option 2 and option 3 parts work
(chosen from data validation list) but the hide and clearcontents don't. I
think that the If Target.Count 1 part is to blame and unfortunately the
cells need to be merged. Is there any way around this.

Thanks in advance.

Gareth


 
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
Worksheet Change Event Tony S.[_2_] Excel Discussion (Misc queries) 11 February 18th 09 01:04 AM
Worksheet change Event ranswert Excel Worksheet Functions 1 January 17th 08 11:17 PM
worksheet change event? Steph[_3_] Excel Programming 5 March 28th 05 06:39 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Worksheet Change Event Eva Shanley[_2_] Excel Programming 1 September 17th 04 11:07 PM


All times are GMT +1. The time now is 06:09 PM.

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"