更改 Excel 2007 中的数字格式

发布于 2024-12-10 13:01:39 字数 339 浏览 0 评论 0原文

在此处输入图像描述

我有一个如下所示的 Excel 文件。我如何更改单元格格式,使其看起来与功能栏完全相同。而不是 3E-07 --> 0.000003

我不想更改小数位数,因为我只希望它具有所需的小数位数,这样末尾就不会出现多余的零。 例如,因为最小的数字有 7 个小数位,如果我将整列更改为 7 个小数位,像 6E-05 这样的数字将在末尾有两个额外的零 (0.0000600)。

我试图在宏观上做到这一点,因为有很多数字需要处理。我可以自己设置循环。

enter image description here

I have an Excel file that looks like this. How would I change the cell formatting so that it looks exactly like it does it the function bar. Instead of 3E-07 --> 0.000003

I don't want to change the decimal places because I only want it to have the number of decimal places it needs so there won't be extra zeroes at the end.
For example because the smallest numbers have 7 decimal places if I change the whole column to seven decimal places numbers like 6E-05 will have two extra zeroes (0.0000600) at the end.

I'm trying to do this on macro because there are a lot of numbers to go through. I can set up the loop myself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稀香 2024-12-17 13:01:41

要修复所有列,请按照以下步骤操作: -

  1. 单击A列提到的符号(即A的左侧)
  2. 当您单击该符号时,它将选择整个工作表
  3. 双击A 列A 列 之间的边框线B 列
  4. 这可以解决 Excel 工作表上的所有问题

此数字格式问题是由于列大小而发生的。

要修复这种类型的数字格式“0.0000600”:-

  1. 选择列标题(即 A 列、B 列......以及您需要格式化的任何列)
  2. 右键单击选项卡
  3. 选择 < strong>“设置单元格格式”
  4. 点击类型字段下
  5. 类别下的自定义选项,输入0.0000000000

然后它会解决您的格式问题。

To fix on all columns, follow below steps:-

  1. Click on the symbol mentioned side of A column (That is left side of A)
  2. When you click on that symbol, it will select whole sheet
  3. Double Click on border line between A column & B column
  4. This is fix all your problems on the excel sheet

This number format issue is occurred due to column size.

To fix this type of number format "0.0000600":-

  1. select the Column header (that is A column, B column .. and soon which ever column you need to format)
  2. Right click on the tab
  3. Select "Format Cell"
  4. Click on custom option under Category
  5. under Type field, enter 0.0000000000

Then it fix your format issue.

南汐寒笙箫 2024-12-17 13:01:41

您已使用 VBA 标记了此问题,因此这里有两个 VBA 的示例 .自动调整方法

对于整个工作表:

    With ActiveSheet    'set this worksheet reference more defintively!
        .Cells.EntireColumn.AutoFit
    End With

如果您的列已经达到您想要的宽度,您可以测试前 20 行,看看 .TEXT 属性 显示散列标记(例如# 或 Chr(35))符号。

    With ActiveSheet    'set this worksheet reference properly!
        With .Cells(1, 1).CurrentRegion
            For c = 1 To .Columns.Count
                For r = 1 To 20     'maybe even .Rows.Count for smaller data grids
                    If CBool(InStr(1, .Cells(r, c).Text, Chr(35), vbBinaryCompare)) Then
                        .Columns(c).EntireColumn.AutoFit
                        Exit For
                    End If
                Next r
            Next c
        End With
    End With

后者使用 .CurrentRegion 属性定义要处理的单元格范围 从原点开始扩展,直到遇到完全空白的行和列。

You have tagged this question with VBA so here are two examples of VBA's .AutoFit method.

For the entire worksheet:

    With ActiveSheet    'set this worksheet reference more defintively!
        .Cells.EntireColumn.AutoFit
    End With

If you have columns that are already the width you want you could test the first 20 rows to see if the .TEXT property is displaying the hash mark (e.g. # or Chr(35)) symbol.

    With ActiveSheet    'set this worksheet reference properly!
        With .Cells(1, 1).CurrentRegion
            For c = 1 To .Columns.Count
                For r = 1 To 20     'maybe even .Rows.Count for smaller data grids
                    If CBool(InStr(1, .Cells(r, c).Text, Chr(35), vbBinaryCompare)) Then
                        .Columns(c).EntireColumn.AutoFit
                        Exit For
                    End If
                Next r
            Next c
        End With
    End With

The latter defined the range of cells to work on using the .CurrentRegion property which expands from its origin until it meets a fully blank row and column.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文