Results 1 to 2 of 2

Replace based on a value in a cell

Threaded View

  1. #1
    Registered User
    Join Date
    03-29-2007
    Posts
    4

    Replace based on a value in a cell

    I want to have a find and replace function that finds and replaces values on a sheet based a cell containing the find value and a cell containing the replace value.

    At the moment i have

    Sub update_month()
    '
    ' update_month Macro
    ' Macro recorded 27/03/2007 by sbarber
    '
    
    '
        Sheets("P&L - Sales").Select
        ActiveCell.Offset(0, -4).Columns("A:A").EntireColumn.Select
        ActiveCell.Offset(-25, -4).Range("A1").Activate
        Selection.Replace What:="C[2]", Replacement:="C[3]", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
    End Sub
    which will find C[2] and replace it with C[3] but i want both of the values to be entered into two cells on the work sheet rather than having to amend the code each time?
    Last edited by stuartb; 03-30-2007 at 12:01 PM.

Thread Information

Users Browsing this Thread

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

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