Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find and replace within a column


Hello,
I tried to use vba to perform find and replace for the first 2 columns
of a few sheets
say the column F1

Sheets(2).Range("F1").Select
Selection.Replace what:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

But in the end, all of the cells are processed.
I'd like to know how should I limit the find and replace range
properly?


--
level3
------------------------------------------------------------------------
level3's Profile: http://www.excelforum.com/member.php...o&userid=34541
View this thread: http://www.excelforum.com/showthread...hreadid=543036

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Find and replace within a column

Range("F:G").Select
THEN do the find

"level3" wrote:


Hello,
I tried to use vba to perform find and replace for the first 2 columns
of a few sheets
say the column F1

Sheets(2).Range("F1").Select
Selection.Replace what:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

But in the end, all of the cells are processed.
I'd like to know how should I limit the find and replace range
properly?


--
level3
------------------------------------------------------------------------
level3's Profile: http://www.excelforum.com/member.php...o&userid=34541
View this thread: http://www.excelforum.com/showthread...hreadid=543036


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find and replace within a column


Hi Bob,
Thanks for the reply


I tried many ways including your suggestion and something like this

Sheets(2).Activate
Range("A:B").Select
Selection.Replace what:="_", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False

Range("F:G").Select
Selection.Replace what:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

But still, every cells' spaces are converted to underscore.
even though I turned on the screen update and saw the selections were
made correctly


--
level3
------------------------------------------------------------------------
level3's Profile: http://www.excelforum.com/member.php...o&userid=34541
View this thread: http://www.excelforum.com/showthread...hreadid=543036

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Find and replace within a column

That is...
Range("F:G").Replace what:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
(No need to select first)

"level3" wrote:


Hello,
I tried to use vba to perform find and replace for the first 2 columns
of a few sheets
say the column F1

Sheets(2).Range("F1").Select
Selection.Replace what:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

But in the end, all of the cells are processed.
I'd like to know how should I limit the find and replace range
properly?


--
level3
------------------------------------------------------------------------
level3's Profile: http://www.excelforum.com/member.php...o&userid=34541
View this thread: http://www.excelforum.com/showthread...hreadid=543036


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
Find & replace in one column Pete Excel Discussion (Misc queries) 4 May 2nd 07 02:23 AM
Find and Replace on just One Column BookerW Excel Discussion (Misc queries) 2 July 31st 06 11:04 PM
Find and Replace in a column Mort Snerd New Users to Excel 2 March 7th 06 03:44 PM
How to find/replace data in column Rock Excel Discussion (Misc queries) 3 November 16th 05 02:28 AM
How to find/replace data in column Rock New Users to Excel 4 November 15th 05 10:52 PM


All times are GMT +1. The time now is 11:25 AM.

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

About Us

"It's about Microsoft Excel"