+ Reply to Thread
Results 1 to 7 of 7

VBA to search for cell and replace value

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Seoul, South Korea
    MS-Off Ver
    Excel 2007
    Posts
    20

    VBA to search for cell and replace value

    This is an extension of my post found here, but trying to approach the problem from a different perspective.
    http://www.excelforum.com/showthread...t=#post4440273
    Based on extensive internet searching and studying VBA (first venture into this world) I have found a code to find a value
    But now I need to develop it in two big ways.
    1) End result should be to replace the value with another value in a different cell, different column but same row (i.e.("f6").value replace with range("i6").value
    2) As this record is repeating, it should loop through the search, redefining "i" and "findstring" and searching until "findstring"="" (i.e. search based on f6, after calculation is complete, search based on f16, f26, etc.)
    The code, which I lightly modified, is as follows: (any advise for improving speed or reliability is appreciated. Total newb)

    Please Login or Register  to view this content.
    Last edited by DaBrot791; 08-09-2016 at 09:47 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Newbie Help needed : VBA to search for cell and replace value

    Moderation removed. Code Tags are added. Thank you, DaBrot791.
    Last edited by Winon; 08-10-2016 at 06:39 AM.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    09-04-2012
    Location
    Seoul, South Korea
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Newbie Help needed : VBA to search for cell and replace value

    Sorry, I could not find the proper way to post it as code. It is corrected now, thank you for the information. Have also changed title in accordance with Rule 1.

  4. #4
    Registered User
    Join Date
    09-04-2012
    Location
    Seoul, South Korea
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: VBA to search for cell and replace value

    This is what I have so far. I've solved my problems... in the sense that I can do what I wanted. However, these records may accumulate to become upwards of 1500 entries.
    Running a test now on only 12 inputs took aproximately 10 seconds to change all of them. Is there a faster way to write this?

    Please Login or Register  to view this content.
    Last edited by DaBrot791; 08-10-2016 at 02:39 AM.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to search for cell and replace value

    Try the Code below, and see if it is faster.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-04-2012
    Location
    Seoul, South Korea
    MS-Off Ver
    Excel 2007
    Posts
    20

    [Solved] VBA to search for cell and replace value

    Wow! that is tremendously faster! I eliminated the clause for findstringnext since that wasn't needed but changing those application settings made it incredibly fast! And it doesn't appear to negatively affect the rest of the worksheet!
    Definitely solved the problem! Thanks a lot! Now I just have to understand what exactly those two values do.
    The following code is just in case someone else is interested.
    Please Login or Register  to view this content.
    Last edited by DaBrot791; 08-10-2016 at 07:44 PM.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to search for cell and replace value

    Hi DaBrot791,

    Thank you for the feedback, and for adding to my Reputation. Much appreciated.

    Glad I could help.

    Regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Search and replace in the first part ONLY of cell
    By researchass in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-03-2014, 02:47 PM
  2. Search and replace character with cell value
    By rfcapinto in forum Excel General
    Replies: 2
    Last Post: 03-24-2014, 05:31 PM
  3. Replies: 5
    Last Post: 05-13-2013, 06:23 PM
  4. Run a search and replace based on what is in another Cell?
    By cekenney in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2012, 03:17 PM
  5. [SOLVED] Excel Search and Replace help needed
    By Blueness in forum Excel - New Users/Basics
    Replies: 13
    Last Post: 07-19-2012, 10:01 AM
  6. Search Column for value in Cell & Replace
    By janglin in forum Excel General
    Replies: 5
    Last Post: 08-22-2006, 11:00 PM
  7. Replies: 5
    Last Post: 09-13-2005, 07:06 AM

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