View Full Version : Show Item on special cell when click on each cell on column E
parscon
12-18-2014, 09:28 AM
Hello
I have data on column E and i need when click on each cell in column E show the same data on cell F2 .
That mean when i click on each cell in column E automatically show the same data only on Cell F2
please help me with formula or VBA code .
Thank you very much
JKwan
12-18-2014, 10:23 AM
how about this?
below is sheet code, so put it into your corresponding sheet
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("E:E")) Is Nothing Then
Exit Sub
Else
MsgBox "F2 - " & [F2]
End If
End Sub
Paul_Hossler
12-23-2014, 05:34 PM
I think I understand. Try this. This code is in the Worksheet module, not a standard module
Selection_Change might also get a block of cells, so I picked the first one to go into F2
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
Set r = Intersect(Target, Me.Columns(5))
'if selected range doesn't overlap col E then exit
If r Is Nothing Then Exit Sub
'if the first cell in the selection is blank then exit
If Len(r.Cells(1, 1).Value) = 0 Then Exit Sub
'turn off events so we don't trigger any more
Application.EnableEvents = False
'put the value into F2
Me.Cells(2, 6).Value = r.Cells(1, 1).Value
'turn events back on
Application.EnableEvents = True
End Sub
Sample attached
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.