Remove all formulas but keep Values throughout workbook

Rude Awakening

New Member
Joined
Jul 10, 2014
Messages
36
Office Version
  1. 365
Hey Guys
I have a workbook with 20+ sheets. All data on the sheets is pulled from a master sheet using the below formula
=XLOOKUP(Table25192224253134636668697231676869161[@['#]]&"|"&$B$1,Table251922242531346364[Count]&"|"&Table251922242531346364[Country],Table251922242531346364[CSI Group],"",0)

I need to remove all formulas but keep values on all sheets.

I've used the below macro based on this thread , but this returns #n/a for all XLOOKUP values

Sub Convert2Values()
Dim oSh As Worksheet
For Each oSh in Worksheets
oSh.UsedRange.Value = oSh.UsedRange.Value
Next
End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Maybe something like:
Backup your original file before doing any modification.
Test on a throw away copy of your workbook.
VBA Code:
Sub test()

Dim oSht As Worksheet

Application.ScreenUpdating = False
For Each oSht In ActiveWorkbook.Sheets
    oSht.Activate
    oSht.UsedRange.Select
    With Selection
        .Copy
        .PasteSpecial xlPasteValues
    End With
    Application.CutCopyMode = False
Next oSht
Application.ScreenUpdating = True

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,636
Messages
6,120,664
Members
448,976
Latest member
sweeberry

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