Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan
 
Posts: n/a
Default Compile error: Ambigious name detected: Worksheet_Change **NEWBIE**

Hi all -
I am getting a Compile error: Ambigious name detected: Worksheet_Change
message when processing my code.

From reading various posts, I see that I can only use the

Worksheet_Change process once.

In my code below, how can I combine these procedures so I can make this
work? Thanks for your help!

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "d5"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Range("c6:c24").Copy Range("c7:c25")
Range("c6").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "q5"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Range("p6:p24").Copy Range("p7:p25")
Range("p6").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Compile error: Ambigious name detected: Worksheet_Change **NEWBIE**

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE1 As String = "d5"
Const WS_RANGE2 As String = "q5"

On Error GoTo ws_exit:
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE1)) Is Nothing Then
Range("c6:c24").Copy Range("c7:c25")
Range("c6").Value = Target.Value
End If

If Not Intersect(Target, Me.Range(WS_RANGE2)) Is Nothing Then
Range("p6:p24").Copy Range("p7:p25")
Range("p6").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub
'-------------------------------------------------------------

HTH
--
AP

"dan" a écrit dans le message de news:
...
Hi all -
I am getting a Compile error: Ambigious name detected: Worksheet_Change
message when processing my code.

From reading various posts, I see that I can only use the

Worksheet_Change process once.

In my code below, how can I combine these procedures so I can make this
work? Thanks for your help!

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "d5"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Range("c6:c24").Copy Range("c7:c25")
Range("c6").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "q5"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Range("p6:p24").Copy Range("p7:p25")
Range("p6").Value = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub



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
compile error in hidden module: autoexecnew - how do I get rid? Joespo Charts and Charting in Excel 1 November 10th 05 03:41 PM
Compile error in hidden module arjay Excel Discussion (Misc queries) 5 September 16th 05 12:47 AM
Compile Errors with Different versions of Excel PStephens Excel Discussion (Misc queries) 2 March 14th 05 04:27 PM


All times are GMT +1. The time now is 11:02 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"