# copy cell to clipboard but not leave cell selected



## nzt101 (Dec 29, 2022)

Hey guys,

i'm using this code to copy to clipboard upon clicking cell C20 or C21, is there a way of copying, without it leaving the cell selected?


```
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("C20:C21")) Is Nothing Then
        Target.Copy
    End If
End Sub
```

thanks in advance


----------



## My Aswer Is This (Dec 29, 2022)

nzt101 said:


> Hey guys,
> 
> i'm using this code to copy to clipboard upon clicking cell C20 or C21, is there a way of copying, without it leaving the cell selected?
> 
> ...


Some cell on the sheet will need to be selected. What cell would you like selected. Or we can have it select a cell on another sheet


----------



## bebo021999 (Dec 29, 2022)

Or, instead of copy, assign value to destination only

```
Dim cell as range
set cell = Sheets("Sheet2").range("A1") ' or = range("A1") if destination is in same sheet
If Not Intersect(Target, Range("C20:C21")) Is Nothing Then
        cell.value = target.value
    End If
```


----------



## nzt101 (Jan 2, 2023)

Hey guys, Happy new year!  
So the below two rows are C20 and C21.






the code i'm using right now, if i click C20 or C21, it copies whatever text is in that cell, in this example HUEPLAY2KIT or the S/N to clipboard, 
I'm copying to clipboard so i can go to another program and CTRL-V to paste it in
thats working, but i'm wondering if theres a way of copying to clipboard without leaving the cell selected as below, 
its not a big deal, but it'd just save me having to hit ESC to continue with that spreadsheet


----------

