Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Simple Find and Replace Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elessvie - 17 Apr 2008 16:26 GMT
Hello, folks!

I'm trying to find and replace a word with another in a column containing
text.  I'm using Ctrl-H, Find = reciept (for example), Replace with =
receipt.  This locates a cell containing the word, but when I press Replace,
Excel displays the error message "Formula is too long."

I've tried formatting the column as General and as Text and get the error
message with both.  I've searched Excel Help and this discussion group, but
haven't been able to find this specific issue addressed, so I'm thinking it's
probably something really obvious!  

Thank you for any help.

-Lynne
Gary''s Student - 17 Apr 2008 17:12 GMT
Specify look in values
Signature

Gary''s Student - gsnu200779

> Hello, folks!
>
[quoted text clipped - 11 lines]
>
> -Lynne
Elessvie - 17 Apr 2008 17:20 GMT
Thanks for response!  But all that's available in the pull-down for Look In
is Formulas.  How do I get it to show Values?

Apologies for all these dumb questions!

-Lynne

> Specify look in values
>
[quoted text clipped - 13 lines]
> >
> > -Lynne
Elessvie - 17 Apr 2008 17:50 GMT
I meant to add that I am able to set Look In Values in the Find pull-down,
but in the Replace With pull-down, it shows only Formulas (Values is not
listed).

What am I doing wrong?

Any help really appreciated!

-Lynne

> Specify look in values
>
[quoted text clipped - 13 lines]
> >
> > -Lynne
Leanne - 19 Apr 2008 09:27 GMT
Is this question still unanswered?  

> I meant to add that I am able to set Look In Values in the Find pull-down,
> but in the Replace With pull-down, it shows only Formulas (Values is not
[quoted text clipped - 23 lines]
> > >
> > > -Lynne
Dave Peterson - 19 Apr 2008 16:23 GMT
Saved from a previous post:

You can use a macro to do the change:

Option Explicit
Sub testme01()

   Dim FoundCell As Range
   Dim ConstCells As Range
   Dim BeforeStr As String
   Dim AfterStr As String

   BeforeStr = "OneWord"
   AfterStr = "aDifferentWord"

   With ActiveSheet
       Set ConstCells = Nothing
       On Error Resume Next
       Set ConstCells = .Cells.SpecialCells(xlCellTypeConstants, _
                                                         xlTextValues)
       On Error GoTo 0

       If ConstCells Is Nothing Then
           MsgBox "Select some cells in the used range"
           Exit Sub
       End If

       With ConstCells
           'get as many as we can in one step
           .Replace what:=BeforeStr, Replacement:=AfterStr, _
                       lookat:=xlPart, SearchOrder:=xlByRows

           Do
               Set FoundCell = .Cells.Find(what:=BeforeStr, _
                                   after:=.Cells(1), _
                                   LookIn:=xlValues, _
                                   lookat:=xlPart, _
                                   SearchOrder:=xlByRows, _
                                   searchdirection:=xlNext, _
                                   MatchCase:=False)

               If FoundCell Is Nothing Then
                   'done, get out!
                   Exit Do
               End If
               FoundCell.Value _
                   = Replace(FoundCell.Value, BeforeStr, AfterStr)
           Loop
       End With
   End With
End Sub

If you're using xl97, change that Replace() to application.substitute()

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ps. Try it against a copy of your data--just in case!

> Hello, folks!
>
[quoted text clipped - 11 lines]
>
> -Lynne

Signature

Dave Peterson

Elessvie - 21 Apr 2008 16:54 GMT
Dear everyone,
Thank you SO much!  I will DEFINITELY try the macro and also look at the
website link.  Just wanted right now to thank you, even though I have no
feedback on the macro at the moment.
-Lynne

> Saved from a previous post:
>
[quoted text clipped - 70 lines]
> >
> > -Lynne
Elessvie - 21 Apr 2008 18:30 GMT
Hi, Dave,

This macro works beautifully!  There are MANY ways we can use it here.  

Thanks again,
-Lynne

> Saved from a previous post:
>
[quoted text clipped - 70 lines]
> >
> > -Lynne
Dave Peterson - 21 Apr 2008 22:57 GMT
But what a pain, huh?????

> Hi, Dave,
>
[quoted text clipped - 81 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Elessvie - 22 Apr 2008 17:21 GMT
Dave, I'm so happy to have something like this, that I can't complain!

-Lynne

> But what a pain, huh?????
>
[quoted text clipped - 83 lines]
> > >
> > > Dave Peterson

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.