Home

Updating Hyperlinks in multiple files

%3CLINGO-SUB%20id%3D%22lingo-sub-561867%22%20slang%3D%22en-US%22%3EUpdating%20Hyperlinks%20in%20multiple%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-561867%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%3CP%3EI'm%20working%20with%20a%20customer%20that%20wants%20to%20copy%20a%20document%20library%20to%20another%20site%20collection%20(both%20in%20SharePoint%20Online).%20They%20have%20a%20number%20of%20excel%20spreadhseets%20that%20have%20hyperlinks%20that%20need%20to%20be%20updated%20to%20the%20new%20site%20collection%20(e.g.%20from%20abc.sharepoint.com%2Fdocumentcenter%2Fdocuments%2Ffilename%20to%20abc.sharepoint.com%2Fsites%2Fdoccenter%2Fdocuments%2Ffilename)%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20scan%20all%20the%20documents%20and%20update%20them%20rather%20than%20do%20it%20manually%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20Thanks%2C%3C%2FP%3E%3CP%3ESuzanne%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-561867%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-562290%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Hyperlinks%20in%20multiple%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-562290%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2076%22%20target%3D%22_blank%22%3E%40Suzanne%20Hunt%3C%2FA%3E%26nbsp%3B%20Take%20a%20look%20at%20the%20VBA%20in%20this%20page%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fexcel.tips.net%2FT003358_Changing_Portions_of_Many_Hyperlinks.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fexcel.tips.net%2FT003358_Changing_Portions_of_Many_Hyperlinks.html%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20can%20be%20easily%20adjusted%20to%20loop%20through%20all%20worksheets%20in%20the%20active%20workbook.%20The%20code%20can%20live%20in%20another%20workbook%2C%20of%20course.%20You'd%20open%20the%20workbook%20that%20has%20the%20code%2C%20then%20open%20the%20workbook%20with%20the%20hyperlinks%2C%20then%20start%20the%20macro.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20need%20help%20adjusting%20the%20VBA%2C%20pipe%20up.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-565251%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Hyperlinks%20in%20multiple%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-565251%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F7724%22%20target%3D%22_blank%22%3E%40Ingeborg%20Hawighorst%3C%2FA%3E%2C%20thanks%20for%20this.%20Was%20hoping%20to%20avoid%20having%20to%20open%20each%20one%20individually%2C%20have%20just%20run%20a%20quick%20Flow%20over%20the%20document%20library%20getting%20documents%20with%20%22Workpapers%22%20in%20the%20title%20(they're%20the%20ones%20that%20need%20updating)%20and%20it%20looks%20like%20there%20are%20438%20of%20them...but%20I%20cant%20see%20an%20easy%20way%20of%20using%20Flow%20so%20it%20might%20just%20have%20to%20be%20done%20like%20this...will%20have%20a%20play%20with%20the%20VBA%20%3A-)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-565615%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Hyperlinks%20in%20multiple%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-565615%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2076%22%20target%3D%22_blank%22%3E%40Suzanne%20Hunt%3C%2FA%3E%26nbsp%3BConceptually%2C%20it%20is%20possible%20to%20use%20VBA%20to%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20get%20a%20list%20of%20all%20files%20in%20a%20directory%3C%2FP%3E%0A%3CP%3E-%20loop%20over%20all%20these%20files%20and%20open%20only%20the%20ones%20that%20match%20certain%20criteria%3C%2FP%3E%0A%3CP%3E--%20loop%20over%20all%20worksheets%20in%20the%20open%20file%3C%2FP%3E%0A%3CP%3E---%20do%20the%20loop%20over%20all%20cells%20that%20swaps%20out%20the%20URL%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20the%20first%20bit%2C%20the%20code%20is%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lang-vb%20prettyprint%20prettyprinted%22%3E%3CCODE%3E%3CSPAN%20class%3D%22kwd%22%3E%3CSPAN%3ESub%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BLoopAllExcelFilesInFolder()%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E'PURPOSE%3A%20To%20loop%20through%20all%20Excel%20files%20in%20a%20user%20specified%20folder%20and%20perform%20a%20set%20task%20on%20them%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E'SOURCE%3A%20www.TheSpreadsheetGuru.com%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EDim%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bwb%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAs%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWorkbook%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EDim%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BmyPath%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAs%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EString%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EDim%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BmyFile%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAs%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EString%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EDim%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BmyExtension%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAs%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EString%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EDim%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BFldrPicker%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EAs%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BFileDialog%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Optimize%20Macro%20Speed%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BApplication.ScreenUpdating%20%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EFalse%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BApplication.EnableEvents%20%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EFalse%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BApplication.Calculation%20%3D%20xlCalculationManual%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Retrieve%20Target%20Folder%20Path%20From%20User%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ESet%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BFldrPicker%20%3D%20Application.FileDialog(msoFileDialogFolderPicker)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWith%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BFldrPicker%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B.Title%20%3D%20%22Select%20A%20Target%20Folder%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B.AllowMultiSelect%20%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EFalse%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EIf%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B.Show%20%26lt%3B%26gt%3B%20-1%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EThen%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EGoTo%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BNextCode%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BmyPath%20%3D%20.SelectedItems(1)%20%26amp%3B%20%22%5C%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EEnd%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWith%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'In%20Case%20of%20Cancel%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ENextCode%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BmyPath%20%3D%20myPath%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EIf%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BmyPath%20%3D%20%22%22%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EThen%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EGoTo%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BResetSettings%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Target%20File%20Extension%20(must%20include%20wildcard%20%22*%22)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BmyExtension%20%3D%20%22*.xls*%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Target%20Path%20with%20Ending%20Extention%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BmyFile%20%3D%20Dir(myPath%20%26amp%3B%20myExtension)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Loop%20through%20each%20Excel%20file%20in%20folder%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EDo%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWhile%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BmyFile%20%26lt%3B%26gt%3B%20%22%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Set%20variable%20equal%20to%20opened%20workbook%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ESet%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bwb%20%3D%20Workbooks.Open(Filename%3A%3DmyPath%20%26amp%3B%20myFile)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Ensure%20Workbook%20has%20opened%20before%20moving%20on%20to%20next%20line%20of%20code%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BDoEvents%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Change%20First%20Worksheet's%20Background%20Fill%20Blue%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bwb.Worksheets(1).Range(%22A1%3AZ1%22).Interior.Color%20%3D%20RGB(51%2C%2098%2C%20174)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Save%20and%20Close%20Workbook%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bwb.Close%20SaveChanges%3A%3D%3C%2FSPAN%3E%3CSPAN%3ETrue%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Ensure%20Workbook%20has%20closed%20before%20moving%20on%20to%20next%20line%20of%20code%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BDoEvents%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Get%20next%20file%20name%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BmyFile%20%3D%20Dir%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ELoop%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E'Message%20Box%20when%20tasks%20are%20completed%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3BMsgBox%20%22Task%20Complete!%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EResetSettings%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Reset%20Macro%20Optimization%20Settings%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BApplication.EnableEvents%20%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ETrue%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BApplication.Calculation%20%3D%20xlCalculationAutomatic%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BApplication.ScreenUpdating%20%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ETrue%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EEnd%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ESub%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3Bfound%20%3CA%20href%3D%22https%3A%2F%2Fwww.thespreadsheetguru.com%2Fthe-code-vault%2F2014%2F4%2F23%2Floop-through-all-excel-files-in-a-given-folder%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhere%20the%20code%20changes%20the%20fill%20colour%20to%20blue%2C%20insert%20the%20code%20that%20loops%20through%20the%20worksheets%20and%20replaces%20the%20URL%20part.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20me%20know%20how%20you%20get%20on.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Suzanne Hunt
Contributor

Hi Everyone,

I'm working with a customer that wants to copy a document library to another site collection (both in SharePoint Online). They have a number of excel spreadhseets that have hyperlinks that need to be updated to the new site collection (e.g. from abc.sharepoint.com/documentcenter/documents/filename to abc.sharepoint.com/sites/doccenter/documents/filename)

Is there a way to scan all the documents and update them rather than do it manually?

 

Many Thanks,

Suzanne

3 Replies

@Suzanne Hunt  Take a look at the VBA in this page 

 

https://excel.tips.net/T003358_Changing_Portions_of_Many_Hyperlinks.html

 

It can be easily adjusted to loop through all worksheets in the active workbook. The code can live in another workbook, of course. You'd open the workbook that has the code, then open the workbook with the hyperlinks, then start the macro.

 

If you need help adjusting the VBA, pipe up.

Hey @Ingeborg Hawighorst, thanks for this. Was hoping to avoid having to open each one individually, have just run a quick Flow over the document library getting documents with "Workpapers" in the title (they're the ones that need updating) and it looks like there are 438 of them...but I cant see an easy way of using Flow so it might just have to be done like this...will have a play with the VBA :-)

@Suzanne Hunt Conceptually, it is possible to use VBA to

 

- get a list of all files in a directory

- loop over all these files and open only the ones that match certain criteria

-- loop over all worksheets in the open file

--- do the loop over all cells that swaps out the URL

 

For the first bit, the code is

 

Sub LoopAllExcelFilesInFolder()
'PURPOSE: To loop through all Excel files in a user specified folder and perform a set task on them
'SOURCE: www.TheSpreadsheetGuru.com

Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim FldrPicker As FileDialog

'Optimize Macro Speed
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual

'Retrieve Target Folder Path From User
  Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)

    With FldrPicker
      .Title = "Select A Target Folder"
      .AllowMultiSelect = False
        If .Show <> -1 Then GoTo NextCode
        myPath = .SelectedItems(1) & "\"
    End With

'In Case of Cancel
NextCode:
  myPath = myPath
  If myPath = "" Then GoTo ResetSettings

'Target File Extension (must include wildcard "*")
  myExtension = "*.xls*"

'Target Path with Ending Extention
  myFile = Dir(myPath & myExtension)

'Loop through each Excel file in folder
  Do While myFile <> ""
    'Set variable equal to opened workbook
      Set wb = Workbooks.Open(Filename:=myPath & myFile)
    
    'Ensure Workbook has opened before moving on to next line of code
      DoEvents
    
    'Change First Worksheet's Background Fill Blue
      wb.Worksheets(1).Range("A1:Z1").Interior.Color = RGB(51, 98, 174)
    
    'Save and Close Workbook
      wb.Close SaveChanges:=True
      
    'Ensure Workbook has closed before moving on to next line of code
      DoEvents

    'Get next file name
      myFile = Dir
  Loop

'Message Box when tasks are completed
  MsgBox "Task Complete!"

ResetSettings:
  'Reset Macro Optimization Settings
    Application.EnableEvents = True
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

End Sub

 found here.

 

Where the code changes the fill colour to blue, insert the code that loops through the worksheets and replaces the URL part.

 

Let me know how you get on.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
PacketMon Components are not loading in WAC 1909
HotCakeX in Windows Admin Center on
2 Replies