Demosthenes&Locke
Board Regular
- Joined
- May 11, 2010
- Messages
- 93
I have 2 sheets, the code is built to activate when a cell on one sheet is selected.
It then activates a different sheet, declares a range, and is supposed to use the replace method to replace a string within a formula.
But it doesn't do anything.
When I try to copy the cell's contents using
thiscellis = cstr(cell.Value)
it says thiscellis is empty, so I believe that is the source of the problem,
somehow it's not giving me a replace error, but it's not actually accessing the cell's in the range and changing each one.
It then activates a different sheet, declares a range, and is supposed to use the replace method to replace a string within a formula.
Code:
ActiveWorkbook.Sheets("BOM").Activate
rngupdtd = "A20:H65"
For Each cell In Range(rngupdtd)
cell.Replace What:=toreplacefilenow, Replacement:=toreplacefilewith, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
cell.Formula = cell.Formula
Next cell
When I try to copy the cell's contents using
thiscellis = cstr(cell.Value)
it says thiscellis is empty, so I believe that is the source of the problem,
somehow it's not giving me a replace error, but it's not actually accessing the cell's in the range and changing each one.