• Copy replace worksheet (Excel XP)

    Author
    Topic
    #410001

    I have 13 spreadsheets. One for each month & then a total Sheet. I am adding 1 field per sheet (1-12) on the Total sheet. Is it possible to delete one of the sheets and then replacing it without getting the formula showing the #ref error.

    I don’t want to copy replace the whole area when I update the sheet but just replace the sheet with a new one same referance.

    I hope I am clear enough, any ideas would be appreciated

    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #877978

      Why not just copy the cells from the new sheet onto the old sheet. The formulas will not get “wiped out” since you have not deleted the references: you have only put new values in all the cells.

      Steve

      • #877980

        That won’t work if the area being copied contains formulas. The formulas will refer back to the sheet they were copied form, not the sheet they are pasted to.

        • #878072

          I was assuming that the summary sheet contained the formulas that refered to the other 12 sheets and the other sheets were just data sheets with no formulas (except perhaps within their own sheet)

          Steve

          • #878243

            Thanks for the advise. I don’t want to go the route to copy & paste special values. I think that the best will be to put a button on the YTD sheet that will redo the formula’s.

            Thanks

            • #878294

              It might be better to use indirect formulas that contain a sheetname that is reference in a cell. Then instead of find/replace in the formulas you can just change the one cell. It might be possible to “autchange” the cell if you can create a formula to determine the sheetname based on a given criteria.

              I am not sure exactly how your formulas and sheets are setup so I can’t provide any more details. Post back with more details and we can provide better instructions on how to do this (if you think this will work)

              Steve

            • #878316

              I’m keen to see how you will use the indirect. Attached is a sample file

              Thanks

            • #878317

              I’m keen to see how you will use the indirect. Attached is a sample file

              Thanks

            • #878332

              For this example you could just use:
              =SUM(‘M01:M12’!B2)

              Then you can insert/delete sheets within the first and last sheets and it will always work keep the entire range. Is this what you are after? or do you really need to use individual sheets?

              Note: you could always include “dummy” first and last sheets in case you need to change any of the 12.

              If you need something else, could you elaborate, the example is not anything like I pictured the original question.

              Steve

            • #878376

              So easy. Brilliant idea

              Thanks

            • #878377

              So easy. Brilliant idea

              Thanks

            • #878333

              For this example you could just use:
              =SUM(‘M01:M12’!B2)

              Then you can insert/delete sheets within the first and last sheets and it will always work keep the entire range. Is this what you are after? or do you really need to use individual sheets?

              Note: you could always include “dummy” first and last sheets in case you need to change any of the 12.

              If you need something else, could you elaborate, the example is not anything like I pictured the original question.

              Steve

            • #878295

              It might be better to use indirect formulas that contain a sheetname that is reference in a cell. Then instead of find/replace in the formulas you can just change the one cell. It might be possible to “autchange” the cell if you can create a formula to determine the sheetname based on a given criteria.

              I am not sure exactly how your formulas and sheets are setup so I can’t provide any more details. Post back with more details and we can provide better instructions on how to do this (if you think this will work)

              Steve

          • #878244

            Thanks for the advise. I don’t want to go the route to copy & paste special values. I think that the best will be to put a button on the YTD sheet that will redo the formula’s.

            Thanks

        • #878073

          I was assuming that the summary sheet contained the formulas that refered to the other 12 sheets and the other sheets were just data sheets with no formulas (except perhaps within their own sheet)

          Steve

        • #878763

          [indent]


          That won’t work if the area being copied contains formulas. The formulas will refer back to the sheet they were copied form, not the sheet they are pasted to.


          [/indent]

          Here’s a couple of macros to work around this problem if cell references don’t need to be adjusted. Select the area to copy and run ApostropheInsert. After copying and pasting run ApostropheRemove while cells are still selected. Run it again on the original selection to restore formulas

          Ken

          Sub ApostropheInsert()
          Dim rngCell As Range
          For Each rngCell In Selection
              If rngCell.HasFormula Then
                rngCell.Value = "'" & rngCell.Formula
              End If
          Next
          End Sub
          
          Sub ApostropheRemove()
          Dim rngCell As Range
          For Each rngCell In Selection
              If Left(rngCell.Value, 1) = "=" Then
                rngCell.Formula = rngCell.Value
              End If
          Next
          End Sub
          
        • #878764

          [indent]


          That won’t work if the area being copied contains formulas. The formulas will refer back to the sheet they were copied form, not the sheet they are pasted to.


          [/indent]

          Here’s a couple of macros to work around this problem if cell references don’t need to be adjusted. Select the area to copy and run ApostropheInsert. After copying and pasting run ApostropheRemove while cells are still selected. Run it again on the original selection to restore formulas

          Ken

          Sub ApostropheInsert()
          Dim rngCell As Range
          For Each rngCell In Selection
              If rngCell.HasFormula Then
                rngCell.Value = "'" & rngCell.Formula
              End If
          Next
          End Sub
          
          Sub ApostropheRemove()
          Dim rngCell As Range
          For Each rngCell In Selection
              If Left(rngCell.Value, 1) = "=" Then
                rngCell.Formula = rngCell.Value
              End If
          Next
          End Sub
          
      • #877981

        That won’t work if the area being copied contains formulas. The formulas will refer back to the sheet they were copied form, not the sheet they are pasted to.

    • #877979

      Why not just copy the cells from the new sheet onto the old sheet. The formulas will not get “wiped out” since you have not deleted the references: you have only put new values in all the cells.

      Steve

    Viewing 1 reply thread
    Reply To: Copy replace worksheet (Excel XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: