Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
On the internet byRef and byVal are differentiated by saying byRef points to a reference and byVal creates a new reference and copies the values from the original. So when you change the passed variable it does not effect the original variable.
But if this is accurate why are the worksheet events such as change and selection_change use byVal. Wouldn't that mean the code should not be able to manipulate the values of the ranges that are being selected. After all byVal should not be able to change the original values only the copies it creates. Yet if you write something like,
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Font.Color = VBA.ColorConstants.vbBlue
End Sub
Anything written in the selected range will actually change their color. So what is really going on here?