Stop formula Auto update on 1 sheet

afinite

New Member
Joined
May 2, 2010
Messages
25
Hi guys,

I have an excel file which uses formulas to display the report's month based on system date. Unfortunately, if someone opens this file in the next month, the value changes...is there any way to stop auto update of this formula after that initial update? or stop auto update of formula on just that 1 sheet (I have other sheets too so cannot turn off formulas completely) ?
 
If Cell B is based off of Cell A, you could just use Copy, Paste Special, Values to remove the formula on Cell A and Cell B would be fine. You could do that manually or by VBA using an ActiveX button that would do it for you and then disappear before you send out the report. Is that a possible solution? Do the reports sent in already have the formula date in Cell A?
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You could do a Copy, Paste Special, Values on Cell A and if Cell B is not reliant upon A, then you could do it on both either manually or by VBA before you sent it out. With VBA you could add an ActiveX button that you could click and have it do the process for you and then it could just disappear. Would that help?
 
Upvote 0
Hello, yes I guess if there is a VBA code that can overwrite values generated by the formula in cell a and cell b as plain text then it would work great! The activex button sounds like a good idea because I can control when to overwrite the values instead of it doing it for me upon opening the file.

Could you please share the code and how to setup the activex button? I highly appreciate your help with this!

You could do a Copy, Paste Special, Values on Cell A and if Cell B is not reliant upon A, then you could do it on both either manually or by VBA before you sent it out. With VBA you could add an ActiveX button that you could click and have it do the process for you and then it could just disappear. Would that help?
 
Upvote 0
Try this. Copy the code below and place it into a Module under VBAProject (PERSONAL.xlsb) in your Visual Basic Editor. Then click the MS Office logo in the upper left of your excel spreadsheet window. Go to > Customize in the left pane, then choose Macros from the "Choose commands from" drop down. Locate your macro in the list below the drop down, it will begin with PERSONAL.XLSB and then the name of the module you put the code in. (i.e.= Module1). Highlight it and click the Add button and it should appear on the right side of the window. It is now a shortcut in your quick access toolbar next to the save and undo buttons. Now when you have the spreadsheet open, just click that button in your quick access toolbar and it will remove the formulas from cells A1 & B1.
Code:
Sub CopyPasteSpecial()
    ActiveSheet.range("A1:B1").Copy
    With range(Cells(1, 1), Cells(1, 2))
        .Copy
        .PasteSpecial Paste:=xlPasteValues
    End With
    Application.CutCopyMode = False
End Sub

[\code]
 
Upvote 0
Hi There, I tried the code but keep getting this error:

A formula in this worksheet contains one or more invalid references.

It does not seem to be replacing the formula with text. I did Alt+f11 -> created a new module -> pasted your code and saved. When I try to save excel spits out that error.

edit: I am using office 2010 - these are the formulas I am use in the cells (if it helps):

A - =TEXT(TODAY()-DAY(TODAY()),"MMMM YYYY")

B - =TEXT(TODAY(),"mmmm yyyy")

Try this. Copy the code below and place it into a Module under VBAProject (PERSONAL.xlsb) in your Visual Basic Editor. Then click the MS Office logo in the upper left of your excel spreadsheet window. Go to > Customize in the left pane, then choose Macros from the "Choose commands from" drop down. Locate your macro in the list below the drop down, it will begin with PERSONAL.XLSB and then the name of the module you put the code in. (i.e.= Module1). Highlight it and click the Add button and it should appear on the right side of the window. It is now a shortcut in your quick access toolbar next to the save and undo buttons. Now when you have the spreadsheet open, just click that button in your quick access toolbar and it will remove the formulas from cells A1 & B1.
Code:
Sub CopyPasteSpecial()
    ActiveSheet.range("A1:B1").Copy
    With range(Cells(1, 1), Cells(1, 2))
        .Copy
        .PasteSpecial Paste:=xlPasteValues
    End With
    Application.CutCopyMode = False
End Sub

[\code][/QUOTE]
 
Last edited:
Upvote 0
Also, how would this:
ActiveSheet.range("A1:B1").Copy
With range(Cells(1, 1), Cells(1, 2))
change if I were to reference different cells - for example Cells H5 and H6 (instead of A1 and B1).
 
Upvote 0
Hi again, so I was playing around and figured out a fix. Not sure if it is correct but it works!

Code:
Sub CopyPasteSpecial()
ActiveSheet.Range("H5:H6", "E9:H9").Copy
With Range("H5:H6", "E9:H9")
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub

Seems to work great! :D Thanks for all your help ;)

Hi There, I tried the code but keep getting this error:

A formula in this worksheet contains one or more invalid references.

It does not seem to be replacing the formula with text. I did Alt+f11 -> created a new module -> pasted your code and saved. When I try to save excel spits out that error.

edit: I am using office 2010 - these are the formulas I am use in the cells (if it helps):

A - =TEXT(TODAY()-DAY(TODAY()),"MMMM YYYY")

B - =TEXT(TODAY(),"mmmm yyyy")
 
Last edited:
Upvote 0
That may be the issue, I am still stuck in 2007. The invalid references shouldn't have anything to do with copy and pasting. Post back the line of code that the macro breaks on if you can. In the Excel options, upper left hand corner icon, you should be able to show the Developer ribbon. You can just record the actions of copy, paste special, values and then replace that code with what I gave you.
 
Upvote 0
I am glad you found your solution. The cell reference: Cells(1,1) is the same as saying "A1". The first number is the row your cell is on and the second number is the column it is in so where those two intersect, that is the cell reference.
 
Upvote 0
I am glad you found your solution. The cell reference: Cells(1,1) is the same as saying "A1". The first number is the row your cell is on and the second number is the column it is in so where those two intersect, that is the cell reference.
Thanks for explaining that! I will try that next time. :)

Again, thanks for all your help with VBA. Amazing tool :stickouttounge:
 
Upvote 0

Forum statistics

Threads
1,225,623
Messages
6,186,063
Members
453,336
Latest member
Excelnoob223

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top