How to get a macro to double click a cell then move to the next

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,573
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,

Ok i'll try not to confuse the situation by explaining why I need this done, i'll just say it vital for what I'm trying to do.

So what I need is a macro that will double click a cell so the curser is in it then click enter so it moves out!

If you want I little move detail here goes but please don't get confused by this part!

I have a list of websites without hyperlinks in column A,
when I double click the cell with the webaddress in it then press enter it turns the webaddess into a hyperlink,
I need this done on about 2000 lines so I need a macro that will simulate double clicking or entering into the cell then pressing enter
if you want to test what I'm talking about put www.bbc.com into a cell right click and remove the hyperlink,
Then double click on the cell and the curser goes into the cell, not selecting the cell but inside it so you can edit the contents, now press enter and the cell with get a hyperlink,
this is what I want.

any ideas how I would do this?
Tony
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,573
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Thanks for your advice VoG but I don't no how to set this up,
I got this code and tried to make it work but the web address is in the cell? im totally confused!
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
As an example with

www.microsoft.com

(not a hyperlink) in A1 - place the hyperlink in B1

Code:
Sub test()
With Range("A1")
    .Offset(, 1).Hyperlinks.Add Anchor:=Range("B1"), Address:="http:/" & Range("A1").Value, TextToDisplay:=Range("A1").Text
End With
End Sub

You should be able to loop this.
 

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,037
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

This is an example for Sheet3 column A, change as necessary
Code:
Sub Addhyperlink()
    Dim I As Integer, wks As Worksheet
    Set wks = Worksheets("Sheet3")
    For I = 1 To Range("A" & Rows.Count).End(xlUp).Row
        wks.Hyperlinks.Add Anchor:=Range("A" & I), Address:=Range("A" & I).Value
    Next I
End Sub
 

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,573
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Momentman! you are amazing! exactly what I needed, thank you so much, I would never have got there on my own! the range & I works perfectly,
A big big thank you.
Tony
 

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,037
Office Version
  1. 365
Platform
  1. Windows
Momentman! you are amazing! exactly what I needed, thank you so much, I would never have got there on my own! the range & I works perfectly,
A big big thank you.
Tony

You are very much welcome
 

Watch MrExcel Video

Forum statistics

Threads
1,109,028
Messages
5,526,332
Members
409,696
Latest member
EERS

This Week's Hot Topics

Top