View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Steve[_4_] Steve[_4_] is offline
external usenet poster
 
Posts: 184
Default Replace with an Offset?

Perfect. Thanks so much Jim. Can I ask for one slight variation to
help solve another problem I have? When it finds "This" in Column A,
can it place "Tada" in Columns C:E and J:K whereever it was found?

On Sep 12, 9:38 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
This should be close. It searches Column A for "This" and places "Tada" in
column C whereever it was found...

Sub ReplaceStuff()
Dim rngToSearch As Range
Dim rngFound As Range
Dim strFirstAddress As String

Set rngToSearch = Sheets("Sheet1").Columns("A")
Set rngFound = rngToSearch.Find(What:="This", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Didn't Find Anything."
Else
strFirstAddress = rngFound.Address
Do
rngFound.Offset(0, 3).Value = "Tada"
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
End If
End Sub

--
HTH...

Jim Thomlinson



"Steve" wrote:
Hello. Is it possible to scan column A for a particular item, and if
it finds it, replace the Value in Column C with something esle? I
know I can do this with an if statement and the use of a helper
column. Is it possible without the use of a helper column? Thanks!- Hide quoted text -


- Show quoted text -