+ Reply to Thread
Results 1 to 5 of 5

Macro to paste formula to selection that replaces a formula with a named range.

  1. #1
    Registered User
    Join Date
    03-22-2017
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    8

    Macro to paste formula to selection that replaces a formula with a named range.

    Hi

    I’m very new to Macro’s and have gotten by, by cutting and pasting from threads on the internet. This one has me stumped. I am trying to select 5 adjacent cells in a spreadsheet and insert a different cell into each cell. The Formula is simple but refers to a named range of cells above.

    I am updating the formula on a large number of existing spreadsheets which contain the same formula but with a different number. When I copy and paste these cells to update a spreadsheet I get a message that says “The sheet you want to copy to contains the name NDISBILL which already exists on the destination worksheet. Do you want to use this version of the name. Click Yes to confirm… I have to click yes 5 times as it cycles through the change to the adjacent cell in the selection.

    This is what I need to put into each cell from left to right on the same row across 5 columns.

    Column G
    =SUM(CHECKBILL1*1.4285)

    Column H
    =SUM(CHECKBILL2*1.4285)

    Column I
    =SUM(CHECKBILL3*1.4285)

    Column J
    =SUM(CHECKBILL4*1.4285)

    Column K
    =SUM(CHECKBILL5*1.4285)

    Any help would be greatly appreciated as at the moment I’m having manually update each workbook by flipping between a workbook I’m copying from and then copying into another workbook.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Macro to paste formula to selection that replaces a formula with a named range.

    I may not be understanding this correctly, but can't you use Find & Replace?

    Find: *1.4285
    Replace: *1.5762 (or whatever the new multiplier is)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-22-2017
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    8

    Re: Macro to paste formula to selection that replaces a formula with a named range.

    Hi - thanks for the quick response. That would work fine. I'd like to put that into a macro as I'll get it to remove the password, change the formulas and then re apply the password.

    I'm not to sure how I would write a macro for that?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Macro to paste formula to selection that replaces a formula with a named range.

    Neither do I, but what I would do is record one. Is the password for all of the workbooks the same?

  5. #5
    Registered User
    Join Date
    03-22-2017
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    8

    Re: Macro to paste formula to selection that replaces a formula with a named range.

    yes it's the same so I'll give it a try - thanks

+ 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: 0
    Last Post: 03-08-2016, 02:25 PM
  2. Macro or formula that replaces part of text
    By Fadzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-29-2016, 04:19 PM
  3. Macro (Button) Paste Named Range in next available row
    By Fett2oo5 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2014, 11:19 AM
  4. Solver macro replaces formula in cell, meaning can't use it more than once
    By Jasminelala in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2013, 08:54 PM
  5. Macro to paste a comparison formula into a selected range
    By aegbert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2012, 04:14 PM
  6. Using VBA to add a VLOOKUP formula without using a named range in the formula
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-06-2012, 01:14 AM
  7. Selection.Replace replaces in entire workbook despite Range.Select
    By robapodaca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2011, 08:23 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