+ Reply to Thread
Results 1 to 7 of 7

VBA to replace all values except one string

  1. #1
    Forum Contributor
    Join Date
    06-01-2015
    Location
    Chennai,India
    MS-Off Ver
    Microsoft Office 2021
    Posts
    146

    VBA to replace all values except one string

    Hi all,

    I just want to replace all values in Column B as "Completed" which does not contains "No".

    Please assist me.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: VBA to replace all values except one string

    Try this code:
    PHP Code: 
    Sub sample3()
    Worksheets("Sheet1").Activate
    Dim i 
    As Long
    Dim lr 
    As Long

    lr 
    Range("A" Rows.Count).End(xlUp).Row
    For lr To 2 Step -1
        
    If Range("B" i).Value <> "No" Then Range("B" i).Value "Completed"
    Next i
    End Sub 

  3. #3
    Forum Contributor
    Join Date
    06-01-2015
    Location
    Chennai,India
    MS-Off Ver
    Microsoft Office 2021
    Posts
    146

    Re: VBA to replace all values except one string

    Sorry for inconvenience. Posted in a wrong forum. Please ignore it.

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: VBA to replace all values except one string

    The admin will move it, don't worry

  5. #5
    Forum Contributor
    Join Date
    06-01-2015
    Location
    Chennai,India
    MS-Off Ver
    Microsoft Office 2021
    Posts
    146

    Re: VBA to replace all values except one string

    Hi Phuocam,

    Thank you so much for your help.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: VBA to replace all values except one string

    You're welcome! Thanks for the rep points.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: VBA to replace all values except one string

    Another option, if your interested.
    Please Login or Register  to view this content.

+ 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. [SOLVED] Replace values in a column with new string
    By Mihaita in forum Excel General
    Replies: 4
    Last Post: 09-01-2017, 01:03 AM
  2. [SOLVED] Replace different part of string with different values
    By vistrup in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-21-2016, 03:41 AM
  3. [SOLVED] Look for string in cell from a list of values. If present replace with a corresponding val
    By dwsf in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-01-2015, 07:34 PM
  4. [SOLVED] Look for string in cell from a list of values. If present replace with a corresponding val
    By dwsf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2015, 03:45 AM
  5. [SOLVED] Find and Replace a String of Values in a Given Row
    By glennchung in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2014, 12:03 PM
  6. Replace Items in a string with corresponding values from an array
    By william1404 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-25-2014, 09:22 PM
  7. Macro to identify column by header and replace number values with string values
    By kang6789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2013, 05:44 PM

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