+ Reply to Thread
Results 1 to 8 of 8

Find and replace

  1. #1
    Registered User
    Join Date
    07-22-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    22

    Find and replace

    Hi,

    I recorded a macro to find "." and replace it with "/". I got the below code to this for me.

    Please Login or Register  to view this content.
    I want this to run in one single tab, but if the last used option in "find and replace" menu was for the whole workbook, this macro is replacing the "." with "/" within the whole workbook, how do I limit this for one single tab.

    Thanks in advance.

    Yathish

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Find and replace

    Hi Yathish.d, let me know if the following does the trick for you
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    07-22-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Find and replace

    Its working fine.

    Thank you.

  4. #4
    Registered User
    Join Date
    03-17-2011
    Location
    hong kong
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Find and replace

    Thanks mordred - I was looking for code to change "." to ":" in a manually entered time string, and this has given me the framework I needed!

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Find and replace

    I'm glad it helped flippertie. As you can see, replacing characters is not that big of a deal. Thanks for the rep too.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Find and replace

    why loop?
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Find and replace

    Quote Originally Posted by pike View Post
    why loop?
    I looped because I thought that once the Find is found it stops doesn't it?

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Find and replace

    Hi,
    The Range.Replace and Range.Find Methods syntax is different but similar
    Once the Value is Found in the Replace the value is Changed so no need to search for it again
    expression.Replace(What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat)
    expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
    the area to Replace is contained within the With Statement
    The With statement lets you specify an object or user-defined type once for an entire series of statements.With statements make your procedures run faster and help you avoid repetitive typing.
    hope that helps

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1