Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default why does cell.replace work with byrows and not with bycolumns

Hi,

I have a macro where I want to replace a certain string with another
string. However, when I put in the macro
Cells.Replace What:="(1 markets)", Replacement:="(1 market)", LookAt:=
_
xlPart, SearchOrder:=xlByColumns, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
it does nothing, but if I change SearchOrder:=xlByColumns to
SearchOrder:=xlByRows, then it works fine.

Can anyone explain why? If it helps, the cells in which the strings to
be replaced can be found are all in 3 cells merged together, with the
string in the left most of the 3 cells (all 3 cells are on the same
row).

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default why does cell.replace work with byrows and not with bycolumns

Merged cells are a pain.

There are somethings that work with merged cells and some (lots???) of things
that don't.

You may want to consider yourself lucky since you do have an alternative.

ps. I tested in xl2003. But each version of excel seems to treat merged cells
a little better. Maybe it works in xl2007 or will work in xl2010????


chris12345 wrote:

Hi,

I have a macro where I want to replace a certain string with another
string. However, when I put in the macro
Cells.Replace What:="(1 markets)", Replacement:="(1 market)", LookAt:=
_
xlPart, SearchOrder:=xlByColumns, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
it does nothing, but if I change SearchOrder:=xlByColumns to
SearchOrder:=xlByRows, then it works fine.

Can anyone explain why? If it helps, the cells in which the strings to
be replaced can be found are all in 3 cells merged together, with the
string in the left most of the 3 cells (all 3 cells are on the same
row).

Thanks!


--

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
Replace in ranges does not work. Cooz Excel Programming 1 April 29th 08 03:06 PM
Limited byrows propagate a value via macro to all cells in column David Excel Worksheet Functions 5 December 8th 05 06:39 PM
find and replace does not work in a linked cell Judith Excel Discussion (Misc queries) 1 September 9th 05 06:24 PM
Does "find and replace" work within a chart? jspalsky Charts and Charting in Excel 2 August 29th 05 09:44 PM
Replace a sheetname with a cell reference to link to another work. lindaw2323 Excel Worksheet Functions 1 November 17th 04 06:20 AM


All times are GMT +1. The time now is 04:51 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"