Hi,
First of all, I have no knowledge of macros or VBAs, I only try to find some useful macros on the net to use when necessary. I have found two such macros recenly, and they work well separately, but not on the same macro page. I keep getting "Compile Error: Ambiguous name detected: Worksheet_Change" I tried to figure it out on my own and it seems to be about two macros having the same name or something.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("'D13") = "New" Then
Rows("7").EntireRow.Hidden = True
Else
Rows("7").EntireRow.Hidden = False
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oneCell As Range
On Error GoTo ErrorOut
For Each oneCell In ActiveSheet.Cells.SpecialCells(xlCellTypeAllValidation)
If Not oneCell.Validation.Value Then oneCell.ClearContents
Next oneCell
ErrorOut:
Application.EnableEvents = True
On Error GoTo 0
End Sub
So, I tried to delete the second name, it stopped giving the error, but the first macro with if function stopped working.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("'D13") = "New" Then
Rows("7").EntireRow.Hidden = True
Else
Rows("7").EntireRow.Hidden = False
End If
Dim oneCell As Range
On Error GoTo ErrorOut
For Each oneCell In ActiveSheet.Cells.SpecialCells(xlCellTypeAllValidation)
If Not oneCell.Validation.Value Then oneCell.ClearContents
Next oneCell
ErrorOut:
Application.EnableEvents = True
On Error GoTo 0
End Sub
I want them both to work at the same time, could anybody help? Thanks in advanced.
Bookmarks