Don't Update Link Macro modification needed

rusted314

Board Regular
Joined
Jan 12, 2010
Messages
74
I need to modify the macro below to not update the links in the workbook it is copying. Currently when I run this macro it asks me after each folder if i want to update or Don't update the links. Is there a way to add in code to not update each file so I dont have to keep answering the prompt 70+ times?




Dim z As Long, e As Long
Dim f As String, b As String, c As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks("master.xls").Sheets("Sheet1").Cells(1, 1) = "=cell(""filename"")"
Workbooks("master.xls").Sheets("Sheet1").Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
Workbooks("master.xls").Sheets("Sheet1").Cells(2, 1).Select
f = Dir(Workbooks("master.xls").Sheets("Sheet1").Cells(1, 2) & "*.xls")
Do While Len(f) > 0
ActiveCell.Formula = f
ActiveCell.Offset(1, 0).Select
f = Dir()
Loop
z = Workbooks("master.xls").Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For e = 2 To z
b = Workbooks("master.xls").Sheets("Sheet1").Cells(e, 1)
If b <> ActiveWorkbook.Name Then
c = Mid(Left(b, Len(b) - 4), 1, 30)
Workbooks.Open Filename:=Workbooks("master.xls").Sheets("Sheet1").Cells(1, 2) & Workbooks("master.xls").Sheets("Sheet1").Cells(e, 1)
Worksheets(MyInput).UsedRange.Copy 'Change sheetname if it is incorrect
ActiveWorkbook.Close False
Sheets.Add.Name = c
Sheets(c).Range("A1").PasteSpecial
End If
Next e
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Worksheets.Add().Name = "Summary"
MsgBox "collating is complete and summary sheet added."
' Local Variables
Dim wks As Worksheet
Dim rngLinkCell As Range
Dim strSubAddress As String, strDisplayText As String
' Step 1 : Loop through all worksheets
' 1a : Clear all current hyperlinks
Worksheets("Summary").Range("A:A").ClearContents
' 1b : Create Linked index list
For Each wks In ActiveWorkbook.Worksheets
Set rngLinkCell = Worksheets("Summary").Range("A65536").End(xlUp)
If rngLinkCell <> "" Then Set rngLinkCell = rngLinkCell.Offset(1, 0)
strSubAddress = "'" & wks.Name & "'!A1"
strDisplayText = wks.Name
Worksheets("Summary").Hyperlinks.Add Anchor:=rngLinkCell, Address:="", SubAddress:=strSubAddress, TextToDisplay:=strDisplayText
Next wks

End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top