View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default assign macro to a lise

Hi

Just change the code to
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
If Target.Value = "YES" Then Macro1
If Target.Value = "NO" Then Macro2
End Sub


--
Regards

Roger Govier


"daidipya" wrote in message
ps.com...
Hi Roger Govier

Thanks for you much needed help
i am a fiannce guy and know nothing of programming but with your help
i
am now able to hide any rows in any sheets by modifying the code.

can you also help me with this
--- Now i want to run different macros depending upon the different
option i choose form the drop down list. for example

if i choose "YES" then Macro1
if i choose "NO" then Macro2

thanks

Roger Govier wrote:
Hi

One way would be to add the following event code to the Sheet1 module

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 10 Then Exit Sub
If Target.Column < 2 Then Exit Sub
HideRows
End Sub

Right click on the Sheet1 tabView CodePaste the above

--
Regards

Roger Govier


"daidipya" wrote in message
ups.com...
i have one macro as follows

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("B10")
If Rng.Value = "YES" Then
Rows("11:50").EntireRow.Hidden = False
Range("B11").Select
ElseIf Rng.Value = "NO" Then
Rows("11:50").EntireRow.Hidden = True
Range("B51").Select
End If
End Sub

now i want that whenever i change in the values in cell B10 the
said
macro should run. Please help me out