excel按拼音顺序排序

If you have a large number of worksheets in your Excel workbook, it may be hard to find a specific worksheet. Sorting your worksheet tabs alphabetically would make it easier to find what your looking for.

如果您的Excel工作簿中有大量工作表,则可能很难找到特定的工作表。 按字母顺序对工作表选项卡进行排序将使查找所需内容更加容易。

In addition to organizing your worksheet tabs by applying colors to them, you can also sort them alphabetically or alphanumerically, as long as you’ve applied custom names to your worksheets. Unfortunately, sorting worksheet tabs alphabetically is not built in to Excel, but you can add a macro to your workbook that will allow you to sort your tabs in ascending or descending order. We’ll show you how to add a macro available on Microsoft’s support site to your Excel workbook that will sort your worksheet tabs.

除了通过将颜色应用于表来组织工作表标签之外,只要您已将自定义名称应用于工作表,还可以按字母或字母数字顺序对其进行排序。 不幸的是,Excel中没有内置按字母顺序排序工作表选项卡的功能,但是您可以在工作簿中添加一个宏,该宏将允许您按升序或降序对选项卡进行排序。 我们将向您展示如何将Microsoft支持网站上可用的宏添加到Excel工作簿中,以对工作表标签进行排序。

To begin, press Alt+F11 to open the Microsoft Visual Basic for Applications (VBA) editor. Then, go to Insert > Module.

首先,请按Alt + F11打开Microsoft Visual Basic应用程序(VBA)编辑器。 然后,转到“插入”>“模块”。

Copy and paste the following macro from Microsoft into the module window that displays.

将以下宏从Microsoft复制并粘贴到显示的模块窗口中。

Sub Sort_Active_Book()
Dim i As Integer
Dim j As Integer
Dim iAnswer As VbMsgBoxResult
'
' Prompt the user as which direction they wish to
' sort the worksheets.
'
iAnswer = MsgBox("Sort Sheets in Ascending Order?" & Chr(10) _
& "Clicking No will sort in Descending Order", _
vbYesNoCancel + vbQuestion + vbDefaultButton1, "Sort Worksheets")
For i = 1 To Sheets.Count
For j = 1 To Sheets.Count - 1
'
' If the answer is Yes, then sort in ascending order.
'
If iAnswer = vbYes Then
If UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) Then
Sheets(j).Move After:=Sheets(j + 1)
End If
'
' If the answer is No, then sort in descending order.
'
ElseIf iAnswer = vbNo Then
If UCase$(Sheets(j).Name) < UCase$(Sheets(j + 1).Name) Then
Sheets(j).Move After:=Sheets(j + 1)
End If
End If
Next j
Next i
End Sub

The VBA editor automatically names each module with a number on the end, such as Module1, Module2, etc. You can simply accept the default name of the module. However, if you plan to add other macros to your workbook, it’s a good idea to rename each module so you know what they are. We’ll rename our module to show you how.

VBA编辑器会自动在每个模块的末尾命名一个数字,例如Module1,Module2等。您可以简单地接受模块的默认名称。 但是,如果您打算将其他宏添加到工作簿中,则最好重命名每个模块,以便知道它们是什么。 我们将重命名模块以向您展示如何进行。

To rename the module, select the text in the Name box for the module under Properties in the left pane.

要重命名模块,请在左侧窗格中“属性”下的模块的“名称”框中选择文本。

Type a name for the module in the Name box and press Enter. Note that the module name cannot contain spaces.

在名称框中键入模块的名称,然后按Enter。 请注意,模块名称不能包含空格。

The name of the module changes in the Modules list under Project in the left pane.

模块的名称在左窗格的“项目”下的“模块”列表中更改。

Close the VBA editor by going to File > Close and Return to Microsoft Excel.

通过转到文件>关闭并返回到Microsoft Excel,关闭VBA编辑器。

Now, we’re going to run the macro to sort our tabs. Press Alt+F8 to access the list of macros on the Macro dialog box. Select the macro in the list (in our case there is only one macro), and click “Run”.

现在,我们将运行宏以对选项卡进行排序。 按Alt + F8可以在“宏”对话框中访问宏列表。 在列表中选择宏(在我们的例子中只有一个宏),然后单击“运行”。

The following dialog box displays, allowing you to choose whether you want to sort your worksheets in ascending or descending order. We want to sort them in ascending order, so we click “Yes”.

将显示以下对话框,您可以选择是否要按升序或降序对工作表进行排序。 我们想按升序对它们进行排序,因此我们单击“是”。

The worksheet tabs are now arranged in alphabetical order.

现在,工作表选项卡按字母顺序排列。

The macro you added is part of your workbook now, but when you save it, you’ll probably see the following dialog box. That’s because you saved your workbook as an .xlsx file, which is a normal Excel workbook format that does not include macros. To include macros in your workbook, and be able to run them, you must save your workbook as a macro-enabled workbook, or an .xlsm file. To do this, click “No” on this dialog box.

您添加的宏现在是工作簿的一部分,但是当您保存它时,您可能会看到以下对话框。 这是因为您将工作簿另存为.xlsx文件,这是不包含宏的普通Excel工作簿格式。 要将宏包含在工作簿中并能够运行它们,必须将工作簿另存为启用了宏的工作簿或.xlsm文件。 为此,请在此对话框上单击“否”。

The Save As dialog box displays. Navigate to where you want to save the macro-enabled workbook, if you’re not already in that folder. Select “Excel Macro-Enabled Workbook (*.xlsm)” from the “Save as type” drop-down list.

显示“另存为”对话框。 如果您还不在该文件夹中,请导航至要保存启用宏的工作簿的位置。 从“另存为类型”下拉列表中选择“ Excel启用宏的工作簿(* .xlsm)”。

Click “Save”.

点击“保存”。

If you don’t save the workbook as a macro-enabled workbook (.xlsm file), the macro you added will be deleted. You might want to delete the .xlsx version of your workbook so you don’t forget to use the .xlsm version of your workbook if you want to add more worksheet tabs and sort them again using the macro. You can always save the workbook as an .xlsx file again if you don’t want to use macros anymore.

如果您不将工作簿另存为启用宏的工作簿(.xlsm文件),则添加的宏将被删除。 您可能想要删除工作簿的.xlsx版本,因此,如果要添加更多工作表选项卡并使用宏再次对其进行排序,请不要忘记使用工作簿的.xlsm版本。 如果您不想再使用宏,则可以始终将工作簿另存为.xlsx文件。

翻译自: https://www.howtogeek.com/280917/how-to-sort-worksheet-tabs-in-alphabetical-order-in-excel/

excel按拼音顺序排序

excel按拼音顺序排序_如何在Excel中按字母顺序排序工作表选项卡相关推荐

  1. java中按字母排序_如何在Java中按字母顺序对字符串进行排序

    使用toCharArray()方法 该类的toCharArray()方法将字符串转换为字符数组并返回它. 按字母顺序对字符串值进行排序获取所需的字符串. 使用toCharArray()方法将给定的字符 ...

  2. java对列表数据排序_如何在Java中对列表进行排序

    java对列表数据排序 Sometimes we have to sort a list in Java before processing its elements. In this tutoria ...

  3. mysql按域排序_如何在MySQL中对域名进行排序?

    要对域名进行排序,请使用ORDER BY SUBSTRING_INDEX().让我们首先创建一个表-mysql> create table DemoTable670(DomainName tex ...

  4. 在excel日期比对大小_如何在Excel中防止分组日期

    在excel日期比对大小 As a teenager, group dates can be fun. If you have strict parents, that might be the on ...

  5. excel公式单元格注释_如何在Excel中隐藏注释,公式,溢出文本和网格线

    excel公式单元格注释 We've shown you how to hide cells, rows, and columns and how to hide worksheets/tabs an ...

  6. python set 排序_python set 排序_如何在Python中使用sorted()和sort()

    点击"蓝字"关注我们 ?"Python基础知识" 大卫·丰达科夫斯基  著 18财税3班 李潇潇    译 日期:2019年5月6日 一. 使用sorted() ...

  7. sql怎么实现线性排序_如何在SQL中实现排序间接

    sql怎么实现线性排序 我最近偶然发现了一个有趣的Stack Overflow问题 ,该问题本质上是用户希望确保以明确定义的顺序交付结果记录. 他们写 SELECT name FROM product ...

  8. mysql 自然排序_如何在mysql中实现自然排序

    背景 熟悉mysql的同学应该清楚,mysql在对字符串做order by排序时是按照字典序进行排序的,但是如果字符串中包含数字的话(我们称这种类型的字符串为alphanumeric),仅按照字典序的 ...

  9. [转载] java中对数组进行排序_如何在Java中对数组排序

    参考链接: Java中main()的有效变体 java中对数组进行排序 Java Array is like a container that can hold a fixed number of t ...

  10. java中对数组进行排序_如何在Java中对数组排序

    java中对数组进行排序 Java Array is like a container that can hold a fixed number of the same type of items, ...

最新文章

  1. SQL中distinct的用法(四种示例分析)
  2. .NET部分知识点整理
  3. (转)程序员的十层楼11层(上帝)
  4. 法定节假日违规组织培训,51talk被通报批评整改不到位
  5. 蓝桥杯——输出米字形
  6. verify code
  7. Android 学习之Fragment的创建
  8. ssm网上球鞋商城(电子商务系统)ssm购物系统,ssm电子产品销售ssm鞋店销售购物ssm商城源码JSP购物系统
  9. Nginx配置带www域名转向无www域名
  10. Android开发什么该做、什么不该做,你真的知道吗?
  11. 机器学习_第四天(线性回归+岭回归+逻辑回归)
  12. Unity出IOS包报错记 -1
  13. c语言编程被7整除的4位数,四位数3a8c能被7整除,且是55的倍数,求a..._一建考试_帮考网...
  14. 限制性定语从句和非限制性定语从句的区别
  15. python版植物大战僵尸源码_基于python的植物大战僵尸游戏设计与实现.docx
  16. 史上最著名的10个思想实验(思想解放运动)
  17. 流氓软件卸载后又自动安装怎么办
  18. html网页制作是什么,DynamicHTML是什么,能具体解释一下么本人初学网页制作, 爱问知识人...
  19. vue面试题系列01
  20. 开始学习ARM 单片机

热门文章

  1. 笔记本打开计算机,笔记本打开黑屏怎么办_笔记本电脑开机黑屏的解决步骤-win7之家...
  2. 不知道rar压缩包密码可以解密么,rar压缩包有密码怎么解开?
  3. 表白代码收藏馆,谁说程序猿不懂浪漫
  4. 【随文杂想】超长图PS 切片为打印机 A4纸大小打印
  5. 创业关于抖音的技术分析与同类产品如何弯道超车的几个问题
  6. Buuctf 神秘龙卷风
  7. 一款高仿微信的app供大家参考
  8. machine learning measurements
  9. 调用ISBN接口查询图书的信息
  10. 前端激荡三十年(一本最详细的编年史册)