I can not achieve to do what looks like an easy process... I would like to give a value ("Hello") to a cell (named "ClInfo") in sheet named "Hardware" by a click on a cell (C47) in sheet named "1".
I tried this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then If Not Intersect(Target, Range("C47")) Is Nothing Then .range("ClInfo").value = "hello" End If
End If What should I do to make it works? Thanks for your help!
1 Answer
Your code could look like the following, it looks like you're just missing the Worksheet object:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Selection.Count = 1 Then If Not Intersect(Target, Range("C47")) Is Nothing Then Worksheets("Hardware").Range("ClInfo").Value = "hello" End If End If
End SubMake sure you're placing this as the VBA for your sheet named 1: