Home |
Search |
Today's Posts |
#1
|
|||
|
|||
excel macro inconsistency
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? |
#2
|
|||
|
|||
Hi
post your used code -- Regards Frank Kabel Frankfurt, Germany "JM" schrieb im Newsbeitrag ... 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? |
#3
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Macro | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) | |||
Excel aficionado wants to learn Access | Excel Discussion (Misc queries) | |||
Excel aficionado wants to learn Access | Excel Discussion (Misc queries) | |||
pivotcell object to excel 2000 | Excel Discussion (Misc queries) |