ambiguous name detected worksheet_change

mickyflash

Board Regular
Joined
Jan 29, 2009
Messages
77
Hi, I understand I cant have two worksheet_changes but I really need both of these codes to work together and I am having trouble merging them into one.

each code runs well independently but I cant get them to work together. Thanks in Advance


VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Const ColumnsToMonitor As String = "C:C"
  Const DateColumn As String = "Z"
  Application.EnableEvents = False
  If Not Intersect(Target, Columns(ColumnsToMonitor)) Is Nothing Then
    Intersect(Target.EntireRow, Columns(DateColumn)).Value = Date
  End If
  Application.EnableEvents = True
End Sub
Code:
Private Sub Worksheet_Change_release(ByVal Target As Range)
  Const ColumnsToMonitor As String = "M:M"
  Const DateColumn As String = "FW"
  Application.EnableEvents = False
  If Not Intersect(Target, Columns(ColumnsToMonitor)) Is Nothing Then
    Intersect(Target.EntireRow, Columns(DateColumn)).Value = Date
  End If
  Application.EnableEvents = True
End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
What about this:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Const ColumnsToMonitor1 As String = "C:C"
    Const DateColumn1 As String = "Z"
    Application.EnableEvents = False
    If Not Intersect(Target, Columns(ColumnsToMonitor1)) Is Nothing Then
        Intersect(Target.EntireRow, Columns(DateColumn1)).Value = Date
    End If

    Const ColumnsToMonitor2 As String = "M:M"
    Const DateColumn2 As String = "FW"
    If Not Intersect(Target, Columns(ColumnsToMonitor2)) Is Nothing Then
        Intersect(Target.EntireRow, Columns(DateColumn2)).Value = Date
    End If
    Application.EnableEvents = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top