search
HomeTopicsexcelExcel converts function calculation results of multiple worksheets into numerical values

This article brings you relevant knowledge about excel, which mainly organizes the related issues of how to convert the function calculation results of multiple worksheets into numerical values, including the functions of a single worksheet. Converting formulas to numerical values, converting formulas to numerical values ​​in multiple worksheets, converting formulas to numerical values ​​in multiple workbooks, etc. Let’s take a look at them together. I hope it will be helpful to everyone.

Excel converts function calculation results of multiple worksheets into numerical values

Related learning recommendations: excel tutorial

How to convert the function calculation results of multiple worksheets into numerical values? Today I will focus on this type of issue with you. Depending on the operating scope, this can be divided into three situations.

  • Convert the formula to a value in a single worksheet

  • Convert the formula to a value in multiple worksheets

  • Converting formulas to numerical values ​​in multiple workbooks

1. Converting regional formulas to numerical values

Let’s talk about the first case first, converting the regional function calculation result to a numerical value. This is the most common and the operation is relatively simple. Copy the target area, right-click and paste selectively as a value.

The operation animation is as follows:

Excel converts function calculation results of multiple worksheets into numerical values

2. Convert multi-sheet formulas to numerical values

If you want to convert all worksheets in the current workbook To convert the formula into a numerical value, you need to use VBA code. The reference code is as follows:

Sub FunctionTransValue_Sheets()
Dim sht As Worksheet
For Each sht In Worksheets '遍历工作表
sht.UsedRange.Value = sht.UsedRange.Value
Next
End Sub

The 3rd to 5th lines of code traverse the worksheet, and the 4th line of code changes the value of the cell to the value, which removes the formula content.

3. Convert formulas to values ​​in multiple workbooks

To convert formulas to values ​​in multiple workbooks under a specified folder, you can copy and run the following code:

Sub FunctionTransValue_Workbooks() '全部工作簿
Dim strPath As String, sht As Worksheet
Dim strWbName As String, wb As Workbook
With Application.FileDialog(msoFileDialogFolderPicker) '获取文件夹路径
If .Show Then strPath = .SelectedItems(1) & "\" Else Exit Sub
End With
On Error Resume Next
With Application
.ScreenUpdating = False '取消屏幕刷新
.DisplayAlerts = False '取消警告信息
.EnableEvents = False '取消事件
.Calculation = xlCalculationManual '取消公式重算
.AskToUpdateLinks = False '取消外链询问
End With
strWbName = Dir(strPath & "*.xls*")
Do While strWbName <> "" &#39;dir语句遍历excel文件
If strWbName <> ThisWorkbook.Name Then
Set wb = Workbooks.Open(strPath & strWbName) &#39;打开工作簿
For Each sht In wb.Worksheets &#39;遍历工作表公式转数值
sht.UsedRange.Value = sht.UsedRange.Value
Next
wb.Close True &#39;保存关闭工作簿
End If
strWbName = Dir() &#39;下一个excel文件
Loop
With Application &#39;恢复系统设置
.ScreenUpdating = True
.DisplayAlerts = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
.AskToUpdateLinks = True
End With
If Err.Number Then
MsgBox Err.Description
Else
MsgBox "转换完成。"
End If
End Sub

The code is analyzed as follows

Lines 4 to 6 of code allow the user to select a target folder and get the path to the folder.

Lines 8 to 14 cancel a series of system settings.

Lines 15 to 25 of code use the conditional loop statement DIR function to traverse the workbook. Lines 19 to 21 of code then traverse the worksheet and convert the formula into a numerical value.

Lines 26 to 32 of code restore a series of system settings.

Lines 33 to 37 code feedback the program running results.

Related learning recommendations: excel tutorial

The above is the detailed content of Excel converts function calculation results of multiple worksheets into numerical values. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel Home. If there is any infringement, please contact admin@php.cn delete
MEDIAN formula in Excel - practical examplesMEDIAN formula in Excel - practical examplesApr 11, 2025 pm 12:08 PM

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

Google Spreadsheet COUNTIF function with formula examplesGoogle Spreadsheet COUNTIF function with formula examplesApr 11, 2025 pm 12:03 PM

Master Google Sheets COUNTIF: A Comprehensive Guide This guide explores the versatile COUNTIF function in Google Sheets, demonstrating its applications beyond simple cell counting. We'll cover various scenarios, from exact and partial matches to han

Excel shared workbook: How to share Excel file for multiple usersExcel shared workbook: How to share Excel file for multiple usersApr 11, 2025 am 11:58 AM

This tutorial provides a comprehensive guide to sharing Excel workbooks, covering various methods, access control, and conflict resolution. Modern Excel versions (2010, 2013, 2016, and later) simplify collaborative editing, eliminating the need to m

How to convert Excel to JPG - save .xls or .xlsx as image fileHow to convert Excel to JPG - save .xls or .xlsx as image fileApr 11, 2025 am 11:31 AM

This tutorial explores various methods for converting .xls files to .jpg images, encompassing both built-in Windows tools and free online converters. Need to create a presentation, share spreadsheet data securely, or design a document? Converting yo

Excel names and named ranges: how to define and use in formulasExcel names and named ranges: how to define and use in formulasApr 11, 2025 am 11:13 AM

This tutorial clarifies the function of Excel names and demonstrates how to define names for cells, ranges, constants, or formulas. It also covers editing, filtering, and deleting defined names. Excel names, while incredibly useful, are often overlo

Standard deviation Excel: functions and formula examplesStandard deviation Excel: functions and formula examplesApr 11, 2025 am 11:01 AM

This tutorial clarifies the distinction between standard deviation and standard error of the mean, guiding you on the optimal Excel functions for standard deviation calculations. In descriptive statistics, the mean and standard deviation are intrinsi

Square root in Excel: SQRT function and other waysSquare root in Excel: SQRT function and other waysApr 11, 2025 am 10:34 AM

This Excel tutorial demonstrates how to calculate square roots and nth roots. Finding the square root is a common mathematical operation, and Excel offers several methods. Methods for Calculating Square Roots in Excel: Using the SQRT Function: The

Google Sheets basics: Learn how to work with Google SpreadsheetsGoogle Sheets basics: Learn how to work with Google SpreadsheetsApr 11, 2025 am 10:23 AM

Unlock the Power of Google Sheets: A Beginner's Guide This tutorial introduces the fundamentals of Google Sheets, a powerful and versatile alternative to MS Excel. Learn how to effortlessly manage spreadsheets, leverage key features, and collaborate

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools