Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default How to do this in VBA?

why don't you simply use the Find/Replace method straight from the Edit menu
item?
Use a macro recorder to view the code thus generated. It'll give you pretty
all you need.

Here is the macro I just recorded, called macro1 and below my edited and
renamed procedure

Sub macro1()
'
' RepaceWith Macro
' Macro recorded 04/05/2005 by pmolloy
'

'
Columns("H:I").Select
Selection.Replace What:="what", Replacement:="with this", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
Sub RepaceWith()
Columns("H:I").Replace What:="what", Replacement:="with this"
End Sub


"Paul" wrote:

I have an Excel workbook with multiple columns and thousand and thousand
rows of data. I want to create a function to loop throught two of the
columns to find a pre-defined search word and replace it with something. I
want to create this in a function on a button. I am new to Excel coding, the
part That I am not sure is how to loop throught a select range (column) to
the end of the row on that column to find the serach word and then it moves
to the next column and finish it to the end of the row of the second column.
Thanks.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to do this in VBA?

I have an Excel workbook with multiple columns and thousand and thousand
rows of data. I want to create a function to loop throught two of the
columns to find a pre-defined search word and replace it with something. I
want to create this in a function on a button. I am new to Excel coding, the
part That I am not sure is how to loop throught a select range (column) to
the end of the row on that column to find the serach word and then it moves
to the next column and finish it to the end of the row of the second column.
Thanks.


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



All times are GMT +1. The time now is 12:41 AM.

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"