PDA

View Full Version : [SOLVED] Copy value of active cell to another worksheet



mykal66
07-18-2019, 02:16 AM
Hi


I have a workbook with worksheets Data & Stats andtrying to copy the value of an active cell to a specific cell in anotherworkbook.


E.g. If the user clicks in any cell in the range A11-A20only (any other active cell does nothing) on the data sheet that value isautomatically copied over to Cell A2 on the Stats sheet


I have tried a few options from the net but can’t getanything to work, is anyone able to help please?


Thanks


Mykal
Active Cell,

mykal66
07-18-2019, 05:56 AM
Hi again
I have managed to get the active cell to copy over using
“Private Sub Worksheet_SelectionChange(ByVal Target AsRange)
Worksheets("Graphs").Range("A2").Value =ActiveCell.Value
End Sub”
Still struggling with limiting the active cells range toJust A11 to A20 if it’s even possible
Thanks
Mykal

Paul_Hossler
07-18-2019, 05:58 AM
Private Sub Worksheet_SelectionChange(ByVal Target AsRange)

If Intersect (Target, Range("A11:A20")) Is Nothing Then Exit Sub


Worksheets("Graphs").Range("A2").Value =ActiveCell.Value


End Sub”

mykal66
07-18-2019, 06:18 AM
Hi Paul



Thank you very much, I had just figured it out using this:


“Private Sub Worksheet_SelectionChange(ByVal Target AsRange)


If Not Intersect(Range("A11:A20"), Target) IsNothing Then


'Worksheets("Graphs").Range("A2").Value= ActiveCell.Value


Else


End If


End Sub”





I came back to mark this as solved and post my code and sawyour response which looks neater, so I have used yours and all works great.


I really appreciate your time in replying and all the helpyou guys have given me in the past too


Mykal