Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default NOT ABLE TO ENTER VB CODE

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

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
can someone help me with code for tab/enter stops? ward376 Excel Programming 0 November 21st 07 06:14 PM
code to enter in returns Ivano Excel Programming 0 August 2nd 06 02:12 AM
ALT + enter or Char(13) in code JL Excel Discussion (Misc queries) 3 April 8th 05 05:27 PM
Enter VBA Code Password Eddie Excel Programming 3 December 2nd 04 02:30 PM
Code equivalent to the Enter-Key JMay Excel Programming 7 May 23rd 04 08:44 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"