ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel macro inconsistency (https://www.excelbanter.com/excel-programming/318597-excel-macro-inconsistency.html)

JM[_6_]

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?


KL[_6_]

excel macro inconsistency
 
Pls. post the code.

KL

"JM" wrote in message
...
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?




Frank Kabel

excel macro inconsistency
 
Hi
see your other post

--
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?



JM[_6_]

excel macro inconsistency
 
Columns("B:B").Select
Selection.Replace What:="-", Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

This code is in a procedure, and is called within the same
module. If I step through the code it works fine.

JM

-----Original Message-----
Pls. post the code.

KL

"JM" wrote in message
...
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?



.


No Name

excel macro inconsistency
 
Code posted in reply to KL

-----Original Message-----
Hi
see your other post

--
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?


.


Frank Kabel

excel macro inconsistency
 
Hi
try:
Activesheet.columns("B:B").Replace What:="-", Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

--
Regards
Frank Kabel
Frankfurt, Germany

"JM" schrieb im Newsbeitrag
...
Columns("B:B").Select
Selection.Replace What:="-", Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

This code is in a procedure, and is called within the same
module. If I step through the code it works fine.

JM

-----Original Message-----
Pls. post the code.

KL

"JM" wrote in message
...
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?



.



JM[_6_]

excel macro inconsistency
 
I figured it out, actually. I was running a query and then
formatting the data, but the query was not finished before
the formatting started. I set the backgroundquery
condition on the refresh command to false, and now ti the
timing is fine. Thanks though!

-----Original Message-----
Hi
try:
Activesheet.columns("B:B").Replace What:="-",

Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

--
Regards
Frank Kabel
Frankfurt, Germany

"JM" schrieb im Newsbeitrag
...
Columns("B:B").Select
Selection.Replace What:="-", Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False

This code is in a procedure, and is called within the

same
module. If I step through the code it works fine.

JM

-----Original Message-----
Pls. post the code.

KL

"JM" wrote in message
...
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?



.


.



All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com