Changing linked formula

J

jolowe

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!!!
 
G

Gary Keramidas

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top