Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Select and replace, help please

Latest post Thu, Oct 27 2011 7:59 AM by igrock. 0 replies.
  • Thu, Oct 27 2011 7:59 AM

    • igrock
    • Not Ranked
    • Joined on Thu, Oct 27 2011
    • Posts 1
    • Points 5

    Select and replace, help please

    Hi everyone

    I need help with the below macro. The first part of the macro selects and copies to clipboard 15 cells in one worksheet then pastes them into another worksheet, finds the value "888" and replaces it with the value "999". Then the second part part of the macro repeats the process from pasting 15 cells starting from row 16.
    I don't have a problem with the first value "888" because it is static and does not change but the second value "999" has to be pulled from another worksheet each time from the next cell down -- A1, A2, A3, etc. And this needs to be on a loop until there is no more values in the A column.

    Does anyone know how to do this? Thanks for your help!




    Sheets("Sheet1").Select
    Selection.Copy
    Sheets("Sheet2").Select
    ActiveSheet.Paste
    Selection.Replace What:="888", Replacement:="999", LookAt:=xlPart, _
    SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    ActiveCell.Offset(15, 0).Range("A1").Select
    ActiveSheet.Paste
    Selection.Replace What:="888", Replacement:="999", LookAt:=xlPart, _
    SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

    • Post Points: 5
Page 1 of 1 (1 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.