show selected or clicked cell value from one column in other cell

ict_shiraz

New Member
Joined
Sep 16, 2023
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hi Dear,
i have a simple sheet with some columns, A to D and column B contains names like john, david,simon and etc.
i used below command to show selected or clicked cell value in other cell (M2).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Target.Value

End Sub


But when i want to change that command for specific range of column B (B3 to B2000) by using commands in below it doesn't work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Range("B2:B2000").Value
End Sub
Or
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Range("B2:B2000").Select
End Sub

I wanna do it for this range only and take no effect on M2 cell value when i select out ranged value and just change other parts manually and commonly.

Kindly advise.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi Dear,
i have a simple sheet with some columns, A to D and column B contains names like john, david,simon and etc.
i used below command to show selected or clicked cell value in other cell (M2).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Target.Value
End Sub


But when i want to change that command for specific range of column B (B3 to B2000) by using commands in below it doesn't work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Range("B2:B2000").Value
End Sub
Or
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("M2").Value = Range("B2:B2000").Select
End Sub

I wanna do it for this range only and take no effect on M2 cell value when i select out ranged value and just change other parts manually and commonly.

Kindly advise.
So you want the values in 1999 cells to be put into one cell?

Can you give us an idea of what this cell will then look like?
 
Upvote 0
Does this do what you want?
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("B3:B2000")) Is Nothing Then Exit Sub
    Range("M2").Value = Target.Value
End Sub
 
Upvote 0
Does this do what you want?
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("B3:B2000")) Is Nothing Then Exit Sub
    Range("M2").Value = Target.Value
End Sub
Dear Mumps,
I do appreciate:love: . exactly your VBA code is what I want.(y)
Best wishes;
 
Upvote 0

Forum statistics

Threads
1,215,243
Messages
6,123,837
Members
449,129
Latest member
krishnamadison

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