Default property of Target

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,924
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have this code which activates when a cell on Sheet1 is changed.


Suppose I double-clicked cell A1.


Hovering the mouse over Target shows $A$1, as expected and the code runs through to teh function, without any problems.


Code:
Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
    
    Call Module1.abc(rng:=Target)
    
End Sub


Here is Module1:


Code:
Option Explicit


Public Function abc(rng As Range)


    ' Do something

End Function


The query I have is, as I understand, the default property for Target is .Value.


But this fails:


Code:
Option Explicit


Private Sub Worksheet_Change(ByVal Target As Range)
    
    Call Module1.abc(rng:=Target.Value)
    
End Sub


even though if I hover the mouse over Target.Value, it still shows $A$1.


Why is that?


Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Your function expects a range, so you can't pass it a value.
 
Upvote 0
'$A$1' is a string.

PS Do yo actually have the value '$A$1' in a cell?
 
Last edited:
Upvote 0
Thanks, I understand now.

No I don't have the value $A$1 in a cell.
 
Upvote 0
If you don't have the value $A$1 in the cell then how are you seeing that when you hover over.:eek:
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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