Restrict range or cell - worksheet change

  • Thread starter Thread starter gatarossi
  • Start date Start date
G

gatarossi

Dear all,

How can I restrict a range and a cell when I put a VBA code in mode
worksheet_change?

I want to restrict more than one different range/cells to call
different codes:

For example, If when I change
cells(1,1) do it...
and when I change range x do another code...

Thanks a lot!!!

André.
 
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit
Application.EnableEvents = False

Select Case Target.Address(False, False)
Case "H1": Call macro1
Case "M1": Call macro2
'etc
End Select
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



Dear all,

How can I restrict a range and a cell when I put a VBA code in mode
worksheet_change?

I want to restrict more than one different range/cells to call
different codes:

For example, If when I change
cells(1,1) do it...
and when I change range x do another code...

Thanks a lot!!!

André.
 
Back
Top