Hoping someone can help with a VBA problem I am having.
I want to change the value for a Named Range when a user double clicks on the cell. There are two worksheets, the initial worksheet with a value in a cell and then the destination worksheet which contains the Named Range Account_Number.
This is my code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
[Account_Number] = ActiveCell.Value 'assign the value to the Named Range
Range([Account_Number]).Select ' go to the Named Range on the other worksheet
'Sheets("Transaction Listing_LINKS").Select 'the workaround to the problem below
End Sub
What I expect is that the Named Range to be populated and selected.
The problem is I get a
"1004 error: Method 'Range' of object '_Worksheet' failed"
error when I double click on the cell.
The strange thing is that if I only use one worksheet it works without any problems.
Can anyone explain to me why this would happen and how to avoid it?
The only fix/workaround I can think of is to code the selection of the worksheet to force it to select it.
Thank you