View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default NOT ABLE TO ENTER VB CODE

Hi,

What you are entering is called event code and the event
Private Sub Worksheet_Change...
is executed whenver the worksheet changes but you can only have one module
with this name. You could try something like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
'do something
End If

If Target.Address = "$B$1" Then
'do something else
End If
End Sub


Mike

"SANDIND" wrote:

I am not able to enter this " Private Sub Worksheet_Change(ByVal Target As
Range" more than once in the sheet code of any particular code.

Once I am entering any macro starting with this it says ambiguos code, I am
new to VB kindly help me out.

Thanks