Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default change links by a macro

I'm using the macro below to change the input file.
I have to do this for 20 spreadsheets which contains 5
similar links each.

The problem is that excel is not been able to locate the
new file and or path.


Sheets.Select

Cells.Select

Selection.Replace What:= _
"H:\2004\[source.XLS]", _
Replacement:= _
"H:\2005\[source.XLS]", LookAt _
:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default change links by a macro

Unless the What string doesn't match entries in the cells, it should work.

Does it work when you do it manually. If so, turn on the macro recorder
while you do it manually and capture the code.


--
Regards,
Tom Ogilvy

"JohnQ" wrote in message
...
I'm using the macro below to change the input file.
I have to do this for 20 spreadsheets which contains 5
similar links each.

The problem is that excel is not been able to locate the
new file and or path.


Sheets.Select

Cells.Select

Selection.Replace What:= _
"H:\2004\[source.XLS]", _
Replacement:= _
"H:\2005\[source.XLS]", LookAt _
:=xlPart, SearchOrder:=xlByRows, MatchCase:=False



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default change links by a macro


"JohnQ" wrote in message
...
I'm using the macro below to change the input file.
I have to do this for 20 spreadsheets which contains 5
similar links each.

The problem is that excel is not been able to locate the
new file and or path.


Sheets.Select

Cells.Select

Selection.Replace What:= _
"H:\2004\[source.XLS]", _
Replacement:= _
"H:\2005\[source.XLS]", LookAt _
:=xlPart, SearchOrder:=xlByRows, MatchCase:=False


Not sure exactly what you want here, but a simple way to make changes in
multiple files is as follows:
this code looks through all open workbooks, writing "Hello" in the top left
cell of sheet 1

For each w in Workbooks
w.Sheets(1).Cells(1,1).Value = "Hello"
Next


If you nest your replace calls inside that For loop, it will replace on
every open workbook.

Iain King


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
How do I change the links in Excel at one batch? LunaMoon Excel Discussion (Misc queries) 1 April 24th 10 12:59 AM
change multiple links at once TaralearningExcel Excel Worksheet Functions 1 April 8th 10 05:32 PM
Change named cells and keep the links BCN Excel Discussion (Misc queries) 1 April 2nd 08 10:11 AM
Change links between 2 spreadsheets Russell-stanely Excel Discussion (Misc queries) 0 September 20th 06 05:46 PM
Writing a macro to change external links to manual updating in Excel 2000 John Wirt[_5_] Excel Programming 6 February 16th 04 08:03 AM


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