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
12Next
Return Post new threads
View: 531|Reply: 10

Double click to open a hiperlink

[Copy link]

1

Topics

1

Posts

7

Integral

Newbie

Rank: 1

Integral
7
Post on 2-11-2017 05:57:51 | All posts |Read mode
Dear Bosses,
In my excel sheet, when I just click in a hyperlinked cell- it opens the file. But what I need is, when I double click in a hiperlinked cell, only then the linked file will open.
Is this really possible? Please let me know, how.
Nazmul.
Reply

Props Report

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 10:27:38 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 11:01:51 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 12:32:56 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 15:42:03 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 16:29:42 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 17:18:29 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 20:34:59 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-11-2017 21:54:53 | 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

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 2-12-2017 00:31: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

12Next
Return Post new threads

Points policy of this forum

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

GMT-5, 9-21-2017 14:34 , Processed in 0.162645 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

!fastreply! Top !return_list!