MobileMobile | Continue

Excel Bar

Excel Bar

Your excel questions will be responsed by our excel experts within 24hrs.Our service is free.

 Forgot Pass?
 Register Now
Find
Hot Search: Vlookup Match VBA
12
Return Post new threads
Author: nahidking

Double click to open a hiperlink

[Copy link]

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-12-2017 03:26:00 | All posts



VBA below uses the value in the cell (not  hyperlink value)
Use to open files or follow internet links etc
VBA set to work only for column 2 (= column B) - amend to suit your requirements
Example: double clicking on cell containing D:\Documents\myfile.xlsm opens myfile.xlsm in folder D:\Documents
Place this in the SHEET module (right click on sheet tab, and View Code)
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Target.Column = 2 Or Target = vbNullString Then Exit Sub   
    ActiveWorkbook.FollowHyperlink Target
    Cells.Hyperlinks.Delete
    Cancel = True
End SubExcel creates hyperlinks automatically if cell value suitable. This line deletes autocreated hyperlink:
Cells.Hyperlinks.Delete
This line cancels cell edit mode after double-click
Cancel = True
Reply Support Opposition

Props Report

12
Return Post new threads

Points policy of this forum

Archiver|Mobile|Small dark house|Contact us|Excel Bar

GMT-5, 9-25-2017 15:41 , Processed in 0.138441 second(s), 17 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

!fastreply! Top !return_list!