LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default run a macro to extract hyperlinked sheet to new workbook

Hi
Here is another solution. The target workbook is created automatically
in the same directory as the original workbook, and will be
overwritten each time the sub runs.

Sub GetLinkedSheets()
Dim Linksworkbook As Workbook
Dim HyperlinkCells As Range
Dim hype As Hyperlink
Application.ScreenUpdating = False
'Named range "HyperlinkCells" in column A
Set HyperlinkCells =
ThisWorkbook.ActiveSheet.Range("HyperlinkCells")
Application.DisplayAlerts = False
Set Linksworkbook = Application.Workbooks.Add
With Linksworkbook
For Each hype In HyperlinkCells.Hyperlinks
hype.Follow
ThisWorkbook.ActiveSheet.Copy befo=.Sheets(1) 'will
be first sheet in Report
Next hype
.SaveAs ThisWorkbook.Path & "\" & "LinksWorkBook.xls"
End With
Application.DisplayAlerts = True
End Sub

regards
Paul

On Apr 28, 2:06*pm, Gary''s Student
wrote:
Here is a sample solution. *Workbooks Book1 and Book2 are already opened.. *We
have a column of hyperlinks in column A of Book1. *They were created with:

Insert Hyperlink

They look like:
Sheet1!A1
Sheet2!A1
.
.
.
The macro:
1. * * *gets the data from the column
2. * * *strips off the cell reference
3. * * *stores the result in an array

The macro then copies the named sheets to Book2.

Sub sheetmover()

Dim shnames() As String
n = Cells(Rows.Count, "A").End(xlUp).Row
ReDim shnames(1 To n)

For i = 1 To n
* * shnames(i) = Split(Cells(i, 1).Value, "!")(0)
Next

For i = 1 To n
* * Workbooks("Book1").Sheets(shnames(i)).Copy
After:=Workbooks("Book2").Sheets(1)
Next
End Sub

--
Gary''s Student - gsnu200781



"dadouza" wrote:
I have a workbook of approx 450 sheets, the first sheet of which is a table
of hyperlinks to all the other sheets in the workbook. What I would like to
be able to do is select a column (containing possibly 100 hyperlinks) and
extract all those hyperlinked sheets to a new workbook. I can obviously do it
manually, but it would take some time so I'm looking for something to do it
automatically.
Any help or ideas wold be greatly appreciated.- Hide quoted text -


- Show quoted text -


 
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
Macro to extract data and paste to a new sheet Les Excel Programming 3 August 11th 06 10:10 AM
macro to extract data of a selected sheet TUNGANA KURMA RAJU Excel Discussion (Misc queries) 1 February 27th 06 06:47 AM
Open Sheet, Run Macro, Extract data CLR Excel Programming 10 November 14th 05 12:53 AM
Extract specific data into its own workbook via macro? Adrian B Excel Discussion (Misc queries) 2 February 24th 05 06:09 AM
Extract workbook name within a macro waveracerr[_18_] Excel Programming 2 February 27th 04 09:48 PM


All times are GMT +1. The time now is 01:35 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"