ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   names on col 1 (https://www.excelbanter.com/excel-programming/338579-names-col-1-a.html)

boogie

names on col 1
 
Please help. I have all the names of my students on column A. Let say A1 is
Sam. A2 is Peter. If I scroll right and click on QA1, I want to see the name
of Sam on a userform1.caption. If I click on M100, I want to see the A100
student's name on userform1.caption. It seems like there is something to do
with target but I just can't make it work with my limited programming
knowledge. Thanks for your help in advance.
Boogie



Tom Ogilvy

names on col 1
 
Right click on the sheet tab, Select View Code and paste in this code.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
if target.count 1 then exit sub
if Target.column 1 then
Userform1.Caption = Cells(target.row,1).Value
Userform1.Show
End if
End Sub



--
Regards,
Tom Ogilvy

"boogie" wrote in message
...
Please help. I have all the names of my students on column A. Let say A1

is
Sam. A2 is Peter. If I scroll right and click on QA1, I want to see the

name
of Sam on a userform1.caption. If I click on M100, I want to see the A100
student's name on userform1.caption. It seems like there is something to

do
with target but I just can't make it work with my limited programming
knowledge. Thanks for your help in advance.
Boogie






All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com