ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing linked formula (https://www.excelbanter.com/excel-programming/412170-changing-linked-formula.html)

jolowe

Changing linked formula
 
I have linked formulas in several workbooks and sheets - I need to change one
of the line numbers in all of them - ..."\Monthly 2008\June 08\[1Charge
Sheet.xlsx]Mon'!$B$5" - I need to change the 5 to a 6. Everything else stays
the same - the Mon changes to each day of the week and the columns are the
same on all the sheets. I used the Find and Replace - putting in "$*$5" will
bring up all the ones I need to change (all of them came up in the find
window) but I can not find a way to change them in the replace window. If I
have to do this one at a time there could be as many as 400 entries - if I
can do it by page there will be only 40 or 50 ... Please - can someone help
me!!!


Gary Keramidas

Changing linked formula
 
you can give something like this a shot:

Sub test()
Dim cell As Range
Dim rng As Range
Dim ws As Worksheet
' i used this formula =Sheet2!$B$5 for testing
Set ws = Worksheets("Sheet1")
Set rng = ws.Range("A1:A6")
For Each cell In rng
cell.Formula = Replace(cell.Formula, "$5", "$6", 1)
Next

End Sub


--


Gary


"jolowe" wrote in message
...
I have linked formulas in several workbooks and sheets - I need to change one
of the line numbers in all of them - ..."\Monthly 2008\June 08\[1Charge
Sheet.xlsx]Mon'!$B$5" - I need to change the 5 to a 6. Everything else stays
the same - the Mon changes to each day of the week and the columns are the
same on all the sheets. I used the Find and Replace - putting in "$*$5" will
bring up all the ones I need to change (all of them came up in the find
window) but I can not find a way to change them in the replace window. If I
have to do this one at a time there could be as many as 400 entries - if I
can do it by page there will be only 40 or 50 ... Please - can someone help
me!!!





All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com