I found the next code to do this
So I rewrote this to
But it’s not working
What should happen
- I deleted the worksheet 'Invoer', from the file “VCS.xls”
- I inserted the worksheet 'Invoer', from the file “VCS - (leeg) v3.2.xls.xls”
- i know there are worksheets that have an error message =#VERW! (because of the removal of the worksheet ‘Invoer’)
- So I want to replace this with =INVOER!
This should happen in different worksheets but all the errors are in the same range = Range("A5:E204").
What I’m doing wrong?
Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Replace What:="per *", Replacement:="", LookAt:=xlPart
Next ws
So I rewrote this to
Code:
Workbooks("VCS.xls").Worksheets("Invoer").Delete
Workbooks("VCS - (leeg) v3.2.xls").Worksheets("Invoer").Copy before:=Workbooks("VCS.xls").Sheets(3)
Dim ws As Worksheet
For Each ws In Workbooks("VCS.xls").Worksheets
ws.Cells.Replace What:="=#VERW!", Replacement:="=INVOER!", LookAt:=xlPart
Next ws
But it’s not working
What should happen
- I deleted the worksheet 'Invoer', from the file “VCS.xls”
- I inserted the worksheet 'Invoer', from the file “VCS - (leeg) v3.2.xls.xls”
- i know there are worksheets that have an error message =#VERW! (because of the removal of the worksheet ‘Invoer’)
- So I want to replace this with =INVOER!
This should happen in different worksheets but all the errors are in the same range = Range("A5:E204").
What I’m doing wrong?