The code has been updated to reference the changes below.
This log system create an external document for Excel called Log.txt, it will create a line in the log.txt
The problem is that when the you enter the merged cells, the value put into PreviousValue (in Worksheet_SelectionChange
) is an array of all of the merged cells, which you can't compare to the the new value. When Worksheet_Change
is fired on the edit, the target is only the top-left cell of the merged range. So let's just track that cell for merged ranges. Replace your Worksheet_SelectionChange
with the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PreviousValue = Target(1).Value
End Sub
Disclaimer: This was tested on Excel for Mac 2011 as I don't have access to Excel for Windows at the moment, but I'm pretty sure that it will work on Excel for Windows as well.