Hi
I have placed the following code into a spreadsheet which works perfectly, however I have copied this code and changed the macros being called but the new vba code is still calling the old macro
original code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim changed As Range
Set changed = Intersect(Target, Range("E9"))
If Not changed Is Nothing Then
If Target.Value = "" Then
Call UnMergeCells1
Exit Sub
End If
If IsNumeric(Target.Value) Then
If Target.Address = Range("E9").Address Then
Call MergeCells1
Else
Call MergeCells1
End If
Else
Application.EnableEvents = False
With Target
.Select
.ClearContents
End With
Application.EnableEvents = True
End If
End If
Set changed = Nothing
End Sub
copied code (changes in bold)
Private Sub Worksheet_Change2(ByVal Target As Range)
Dim changed As Range
Set changed = Intersect(Target, Range("E10"))
If Not changed Is Nothing Then
If Target.Value = "" Then
Call UnMergeCells2
Exit Sub
End If
If IsNumeric(Target.Value) Then
If Target.Address = Range("E10").Address Then
Call MergeCells2
Else
Call MergeCells2
End If
Else
Application.EnableEvents = False
With Target
.Select
.ClearContents
End With
Application.EnableEvents = True
End If
End If
Set changed = Nothing
End Sub
Although I have changed the name of the code, cell references and the calls for macros the code is still calling for the original macros (numbered 1)
Any help would be greatly appreciated
I have placed the following code into a spreadsheet which works perfectly, however I have copied this code and changed the macros being called but the new vba code is still calling the old macro
original code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim changed As Range
Set changed = Intersect(Target, Range("E9"))
If Not changed Is Nothing Then
If Target.Value = "" Then
Call UnMergeCells1
Exit Sub
End If
If IsNumeric(Target.Value) Then
If Target.Address = Range("E9").Address Then
Call MergeCells1
Else
Call MergeCells1
End If
Else
Application.EnableEvents = False
With Target
.Select
.ClearContents
End With
Application.EnableEvents = True
End If
End If
Set changed = Nothing
End Sub
copied code (changes in bold)
Private Sub Worksheet_Change2(ByVal Target As Range)
Dim changed As Range
Set changed = Intersect(Target, Range("E10"))
If Not changed Is Nothing Then
If Target.Value = "" Then
Call UnMergeCells2
Exit Sub
End If
If IsNumeric(Target.Value) Then
If Target.Address = Range("E10").Address Then
Call MergeCells2
Else
Call MergeCells2
End If
Else
Application.EnableEvents = False
With Target
.Select
.ClearContents
End With
Application.EnableEvents = True
End If
End If
Set changed = Nothing
End Sub
Although I have changed the name of the code, cell references and the calls for macros the code is still calling for the original macros (numbered 1)
Any help would be greatly appreciated
Last edited: