Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

NOT ABLE TO ENTER VB CODE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SANDIND - 26 May 2008 16:29 GMT
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
Mike H - 26 May 2008 16:53 GMT
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

> 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.
[quoted text clipped - 3 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.