Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JM
 
Posts: n/a
Default 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   Report Post  
Frank Kabel
 
Posts: n/a
Default

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   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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro Danny Excel Discussion (Misc queries) 6 December 8th 04 07:11 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Excel aficionado wants to learn Access Hari Excel Discussion (Misc queries) 0 December 3rd 04 06:03 AM
Excel aficionado wants to learn Access Hari Excel Discussion (Misc queries) 0 December 3rd 04 05:47 AM
pivotcell object to excel 2000 Kellyc Excel Discussion (Misc queries) 0 December 1st 04 03:45 PM


All times are GMT +1. The time now is 09:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"