Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Run VBA hyperlink module on open

This is a cross post, but appears this group is more active.

I have a list of URLs in text format on Col E of a spreadsheet (for example:
http//google.com but in text, not as a link.) Data starts at Row 10.

Upon open, I am trying to use the following VBA module to select all data in
the col from E10 to end of col, then copy the URL text and convert them to
links upon opening the file.

Option Explicit
Sub Auto_Open()
'Select cells in column from Row 10 to End of Col. Alter Letter to
adjust column
Range("E10:E" & Cells(Rows.Count, "e").End(xlUp).Row).Select

'Make Links from URLs
For Each xCell In Selection
ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell
End Sub

The code selects E10 but does not create a link from the text and does not
cycle thru the range. I placed a stop point before the For statement and the
range was not selected.

Any suggestions?

Thanks,



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Run VBA hyperlink module on open

Brent,

Your code worked fine for me.

One thing that may be causing a problem is your use of xCell.Formula - try
using xCell.Text instead. Also, you don't need to select anything to work on
it:

'Find cells in column from Row 10 to End of Col.
'Alter Letter to adjust Column
Dim myRow As Long

myRow = Cells(Rows.Count, "e").End(xlUp).Row

'Make Links from URLs
For Each xCell In Range("E10:E" & myRow)
ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Text
Next xCell


HTH,
Bernie
MS Excel MVP





"Brent E" wrote in message
...
This is a cross post, but appears this group is more active.

I have a list of URLs in text format on Col E of a spreadsheet (for
example:
http//google.com but in text, not as a link.) Data starts at Row 10.

Upon open, I am trying to use the following VBA module to select all data
in
the col from E10 to end of col, then copy the URL text and convert them to
links upon opening the file.

Option Explicit
Sub Auto_Open()
'Select cells in column from Row 10 to End of Col. Alter Letter to
adjust column
Range("E10:E" & Cells(Rows.Count, "e").End(xlUp).Row).Select

'Make Links from URLs
For Each xCell In Selection
ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell
End Sub

The code selects E10 but does not create a link from the text and does not
cycle thru the range. I placed a stop point before the For statement and
the
range was not selected.

Any suggestions?

Thanks,





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart Class Module/follow on question to hyperlink post earlier. Rominall Charts and Charting in Excel 2 March 7th 07 02:43 AM
Hyperlink to VB Module Chaplain Doug Excel Programming 1 February 28th 06 06:26 PM
Textbox Hyperlink opens VB Editor at Specific Module Neily[_3_] Excel Programming 0 October 26th 05 12:04 PM
file open via IE hyperlink causes already open files to shrink and tile Marc Setting up and Configuration of Excel 0 May 4th 05 08:13 PM
Open a XLS from a Module Giorgio[_2_] Excel Programming 3 December 17th 03 02:40 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"