+ Reply to Thread
Results 1 to 4 of 4

Help, need VBA to Find and Replace with the values of the Cell right next to it.

Hybrid View

  1. #1
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Smile Help, need VBA to Find and Replace with the values of the Cell right next to it.

    Hi, I need a macro to search Column N for the keyword "No Postal Shipping Available" and replace every cell with the values that is right next to it


    eg

    1pc Cheapest Postal Shipping Price
    1pc Cheapest Express Courier Shipping Price
    24.43 79.64
    No Postal Shipping Available 88.92
    24.47 32.88
    No Postal Shipping Available 134.42
    56.89 78.84
    So If No Postal Shipping Available <---copy this to the left: 128.29


    I have already try with the macro recorder but I can't do anything, I need help..

    Thanks

    UPDATE!!!
    The solution is below (THANK YOU "mehmetcik")
    Last edited by lagiosman; 03-30-2014 at 08:07 AM.
    ~Our technology has exceeded our humanity~

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help, need VBA to Find and Replace with the values of the Cell right next to it.

    This is quite easily done.

    Let me create the code for you.

    Sub Select_Select()
    
        With Range("N1:N" & Selection.SpecialCells(xlCellTypeLastCell).Row)
            Set rngFind = .Find("No Postal Shipping Available", .Cells(1, 1), LookIn:=xlValues, lookat:=xlPart)
            If Not rngFind Is Nothing Then
                strFirstAddress = rngFind.Address
                Set rngPicked = rngFind
                Do
                    Set rngPicked = Union(rngPicked, rngFind)
                    Set rngFind = .FindNext(rngFind)
                Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
            End If
        End With
        
        If Not rngPicked Is Nothing Then
            rngPicked.Select
            
            For Each c In Selection
            
            c.Value = c.Offset(0, 1).Value
            
            Next
            
        End If
    
    End Sub
    Change
     lookat:=xlPart
    to
    lookat:=xlWhole
    if you want the cell to be exactly "No Postal Shipping Available".
    Last edited by mehmetcik; 03-30-2014 at 08:06 AM.

  3. #3
    Registered User
    Join Date
    07-28-2013
    Location
    Athens
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Help, need VBA to Find and Replace with the values of the Cell right next to it.

    ohhh thank you mehmetcik, it works, thank you very mutch.....
    Last edited by lagiosman; 03-30-2014 at 08:04 AM.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help, need VBA to Find and Replace with the values of the Cell right next to it.

    I have edited the code to minimise it for you.

    So only look at the latest code.

    Enjoy.

+ 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. Macro to find all specific values in column and replace adjacent cell values
    By dblock02 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2013, 06:03 AM
  2. [SOLVED] Faster way to find and replace multiple values with corresponding values
    By babbeleme1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-18-2013, 06:50 PM
  3. Find/Replace Cell Values with Named Ranges
    By enk529 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2010, 06:07 PM
  4. Find, Replace with and then replace adjacent cell
    By Craig2097 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2009, 12:42 PM
  5. Find and Replace values from multiple lookup values
    By Gregula82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2007, 03:12 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