Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Editing Replace function Macro (VBA)

    Hi,

    I have tried modifying the Replace function created by a macro.

    The macro below works fine apart from two things.

    It only searches and replaces one input at a time i.e. 99FUG- I need it to select an entire column from B3:B143 (old data) and replace with D3143 (New Data).

    I need to continue the replace function until it reaches the last row in the old data column i.e. B134

    How could I do this, any help you may be able to provide will be appreciated.

    Sub Macro1()
    '
    ' Macro1 Macro

    ' Macro recorded 30/03/2005 by iyunus
    ''

    '
    Range("B1:E901").Select

    Sheets("Sheet3 (2)").Select

    Columns("C:E").Select

    Range("C170").Activate

    OldCode = Range("B3:B143") Could I not use the named range in the

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Editing Replace function Macro (VBA)

    If you just need to replace e.g. B3 with D3 and B4 with D4, etcetera, this is quite simple:

    With Thisworkbook.Worksheets("Sheet1")
    .Range("B3:B243").Value=.Range("D3243").Value
    End With
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •