Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Find all Hyperlinks present in a sheet

i need a vba code which finds all hyperlinks present in a sheet and
pastes it in a new sheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Find all Hyperlinks present in a sheet

Sub HyperCopy()
Dim s1 As Worksheet, s2 As Worksheet
Dim h As Hyperlink, s As String
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each h In s1.Hyperlinks
s = h.Parent.Address
s1.Range(s).Copy s2.Range(s)
Next
End Sub

--
Gary''s Student - gsnu200909
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find all Hyperlinks present in a sheet

Just to follow up on Gary''s Student's method... in case you do not want to
copy the hyperlinks from Sheet1 into the same cells addresses over in
Sheet2, but would rather place them adjacent to each other in a column
starting from a specified cell (I used cell C3 in my code), then you can do
it this way...

Sub HyperCopy()
Dim s1 As Worksheet, s2 As Worksheet
Dim h As Hyperlink, s As String, Index As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each h In s1.Hyperlinks
s1.Range(h.Parent.Address).Copy s2.Range("C3").Offset(Index, 0)
Index = Index + 1
Next
End Sub

And, of course, if necessary, you can go across the row (starting in C3)
rather than down the column by changing the Offset property call to
Offset(0,Index) instead.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Sub HyperCopy()
Dim s1 As Worksheet, s2 As Worksheet
Dim h As Hyperlink, s As String
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
For Each h In s1.Hyperlinks
s = h.Parent.Address
s1.Range(s).Copy s2.Range(s)
Next
End Sub

--
Gary''s Student - gsnu200909


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Find all Hyperlinks present in a sheet

thanks a lot
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
Locating if a Sheet is present in a workbook Shane Excel Discussion (Misc queries) 3 October 29th 09 08:20 PM
Find any letters present in a range - an example [email protected] Excel Programming 1 March 20th 07 04:47 PM
Command for present sheet kanuvas[_9_] Excel Programming 2 November 14th 05 12:05 PM
testing whether a sheet is present Jeff Excel Programming 3 August 14th 05 04:07 PM
finding a value thats present more than once in a sheet monika Excel Programming 2 March 3rd 04 05:34 PM


All times are GMT +1. The time now is 02:39 PM.

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

About Us

"It's about Microsoft Excel"