View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just a guess.

Sometimes when I step through the code, I'll be swapping between the VBE and
excel--so the correct worksheet is the activesheet.

If you're trying to run the code against a specific sheet, maybe you're getting
the wrong sheet (using the activesheet instead of the specific one).

with worksheets("sheet1")
cells.replace ....
end with

would work against the activesheet since I omitted the leading dot in front of
..cells:

with worksheets("sheet1")
.cells.replace ....
end with

And if your code is in a worksheet module, maybe you're not doing the correct
sheet, too. An unqualified range will go to the sheet that owns the code--not
the activesheet.



JM wrote:

I recorded a macro which selects a column and then
replaces all instances of "-" with "". I cut and pasted
the recorded code into a larger macro. If I run the macro
it does not execute the replacement, but does not generate
any errors. If I step through the macro via the debugger
the replace executes properly. Anyone know what is going
on? Some kind of timing issue?


--

Dave Peterson