Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default using 2 Worksheet Change Event in a sheet, is it possible?

I'm a quite new to VBA

With help from Gary''s Student in Excel Functions section i have written
the following macro to unhide cell based on the value of Cell $I$20 which has
a drop down list .
.................................................. .. VBA Code
..............................................
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("I20")) Is Nothing Then
Exit Sub
End If

Rows("21:218").EntireRow.Hidden = True
unhide_um = Array("21:38", "21:56", "21:74", "21:92", "21:110", "21:128",
"21:146", "21:164", "21:182", "21:200", "21:218")
v = Range("I20").Value
If v = 0 Then
Exit Sub
End If
Rows(unhide_um(v - 1)).EntireRow.Hidden = False
End Sub
.................................................. .................................................. ........
what i require is to create a similar procedure in Cell $I$224 which will
unhide cell
"225:242", "225:260", "225:278", "225:296", "225:314", "225:332", "225:350",
"225:368" based on the value of Cell $I$224

I tried to create same worksheet Change event code but got a Run time error.
Any help will highly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default using 2 Worksheet Change Event in a sheet, is it possible?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$20" Then
' present code
ElseIf Target.Address = "$I$224" Then
' new code
End If
End Sub

Regards,
Stefi

€˛Rajat€¯ ezt Ć*rta:

I'm a quite new to VBA

With help from Gary''s Student in Excel Functions section i have written
the following macro to unhide cell based on the value of Cell $I$20 which has
a drop down list .
.................................................. . VBA Code
.............................................
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("I20")) Is Nothing Then
Exit Sub
End If

Rows("21:218").EntireRow.Hidden = True
unhide_um = Array("21:38", "21:56", "21:74", "21:92", "21:110", "21:128",
"21:146", "21:164", "21:182", "21:200", "21:218")
v = Range("I20").Value
If v = 0 Then
Exit Sub
End If
Rows(unhide_um(v - 1)).EntireRow.Hidden = False
End Sub
.................................................. .................................................. ......
what i require is to create a similar procedure in Cell $I$224 which will
unhide cell
"225:242", "225:260", "225:278", "225:296", "225:314", "225:332", "225:350",
"225:368" based on the value of Cell $I$224

I tried to create same worksheet Change event code but got a Run time error.
Any help will highly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using 2 Worksheet Change Event in a sheet, is it possible?

Hi

Private Sub Worksheet_Change(ByVal Target As Range)
Dim unhide_um, v As Integer

Select Case Target.Address
Case Is = Range("I20").Address
Rows("21:218").EntireRow.Hidden = True
unhide_um = Array("21:38", "21:56", "21:74", "21:92", "21:110",
"21:128", _
"21:146", "21:164", "21:182", "21:200",
"21:218")
v = Range("I20").Value

Case Is = Range("I224").Address
Rows("225:368").EntireRow.Hidden = True
unhide_um = Array("225:242", "225:260", "225:278", "225:296",
"225:314", _
"225:332", "225:350", "225:368")
v = Range("I224").Value
Case Else
End Select

If v = 0 Then Exit Sub
Rows(unhide_um(v - 1)).EntireRow.Hidden = False
End Sub


"Rajat" wrote in message
...
I'm a quite new to VBA

With help from Gary''s Student in Excel Functions section i have
written
the following macro to unhide cell based on the value of Cell $I$20 which
has
a drop down list .
.................................................. . VBA Code
.............................................
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("I20")) Is Nothing Then
Exit Sub
End If

Rows("21:218").EntireRow.Hidden = True
unhide_um = Array("21:38", "21:56", "21:74", "21:92", "21:110", "21:128",
"21:146", "21:164", "21:182", "21:200", "21:218")
v = Range("I20").Value
If v = 0 Then
Exit Sub
End If
Rows(unhide_um(v - 1)).EntireRow.Hidden = False
End Sub
.................................................. .................................................. ......
what i require is to create a similar procedure in Cell $I$224 which will
unhide cell
"225:242", "225:260", "225:278", "225:296", "225:314", "225:332",
"225:350",
"225:368" based on the value of Cell $I$224

I tried to create same worksheet Change event code but got a Run time
error.
Any help will highly appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default using 2 Worksheet Change Event in a sheet, is it possible?

Thanks a lot BIG BROTHER

Regards

Rajat



Reply
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 - copy cell to another sheet dhstein Excel Discussion (Misc queries) 2 October 12th 09 06:35 PM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Sheet Name Change Event? Bob Phillips[_5_] Excel Programming 0 August 18th 03 09:57 PM


All times are GMT +1. The time now is 06:54 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"