ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hyperlink macro (https://www.excelbanter.com/excel-programming/352939-hyperlink-macro.html)

choice[_2_]

hyperlink macro
 
is there a way to have it when i click on cell A1 it will have a message box
of value in b1. if i click on a2, message box of b2...etc

thanks in advance


Norman Jones

hyperlink macro
 
Hi Choice,

Try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("A1:A10") '<<==== CHANGE

If Not Intersect(rng, Target) Is Nothing Then
With Target
MsgBox "The value of " & .Address(0, 0) _
& " = " & Target.Offset(0, 1).Value
End With
End If

End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



"choice" wrote in message
...
is there a way to have it when i click on cell A1 it will have a message
box
of value in b1. if i click on a2, message box of b2...etc

thanks in advance





All times are GMT +1. The time now is 06:18 AM.

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