+ Reply to Thread
Results 1 to 3 of 3

Macro to amend part of formula repeatedly for remainder of sheet

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    Canterburym England
    MS-Off Ver
    Excel 2010
    Posts
    7

    Macro to amend part of formula repeatedly for remainder of sheet

    Hi,

    I am trying to write a Macro to replace the value: 100-570-015 within a formula, with the number in column A of that line, and repeat for every line in the list. The incorrect macro i have is as follows:

    Do Until IsEmpty(ActiveCell)

    ActiveCell.EntireRow.Select
    ActiveCell.Copy
    Selection.Formula.Replace What:="100-570-015", Replacement:=ActiveCell.Value, LookAt:= _
    xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    Selection.Offset(1, 0).Select
    Loop

    End Sub

    I need the value in column A to replace the original value in every cell in each row.

    Help would be much appreciated.

    Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro to amend part of formula repeatedly for remainder of sheet

    Hi
    The easiest way to do this is to store your value in a separate cell (this can be on a separate worksheet if required) and refer to that cell within your formula. That way you can change the value in the relevant cell and all your formulae will use the new value without having to use VBA.
    Hope this helps.
    Tony

  3. #3
    Registered User
    Join Date
    05-08-2013
    Location
    Canterburym England
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Macro to amend part of formula repeatedly for remainder of sheet

    Quote Originally Posted by ARGK View Post
    Hi
    The easiest way to do this is to store your value in a separate cell (this can be on a separate worksheet if required) and refer to that cell within your formula. That way you can change the value in the relevant cell and all your formulae will use the new value without having to use VBA.
    Hope this helps.
    Tony
    Hi Tony,

    The value changes with each line. Currently the rows all have same formula as created the references to external sheet in the correct cells, however now want to amend the rows below to refere to their specific sheet dependant on the value in A2, adding these values on another sheet would mean I still have to rewrite formulas doesn't it? Which for 920 lines and 54 columns is a lot of rewriting.

    example of the cell formula is:
    ='W:\File\File\File\File\Stock Build\[Tracker.xlsx]100-570-015'!$E$16

+ 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. Replies: 16
    Last Post: 01-20-2013, 09:40 AM
  2. Amend columns in a formula that lookup values from temp sheet
    By sukyb1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2012, 05:22 AM
  3. Amend my worksheets to one sheet macro
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2011, 11:47 AM
  4. Recalculate sheet repeatedly until condition met
    By montreal1775 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2008, 03:45 PM
  5. Replies: 2
    Last Post: 11-15-2006, 11:04 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