excel vba代码大全_更改Excel VBA代码以提高速度-程序员宅基地

技术标签: excel  python  java  机器学习  大数据  

excel vba代码大全

In some of my files, macros run automatically when you select a cell on the worksheet. For example, if you've bought a copy of my Data Validation Multi-Select Premium (DVMSP) kit, it shows a pop-up list when you click on a cell with a drop down list.

在我的某些文件中,当您在工作表上选择一个单元格时,宏会自动运行。 例如,如果您购买了我的数据验证多选高级(DVMSP)套件的副本,则在单击带有下拉列表的单元格时,它将显示一个弹出列表。

I'll show you how to quickly change that, so the pop-up appears when you double-click, and you could make a similar change in other worksheet code.

我将向您展示如何快速进行更改,因此,当您双击该弹出窗口时,您可以在其他工作表代码中进行类似的更改。

使用双击 (Use a Double-Click)

If you find that the DVMSP code is slow in a big workbook, or if you don't want to see the pop-up list as you move around the workbook, you can make a simple change to its code.

如果发现大型工作簿中的DVMSP代码运行缓慢,或者在工作簿中移动时不希望看到弹出列表,则可以对其代码进行简单的更改。

Instead of showing the pop-up list when a cell is selected, change the code to run when a cell is double-clicked. That should speed things up a bit, and the pop-up list will only appear when you want it to.

选中单元格时,不用显示弹出列表,而是将代码更改为在双击单元格时运行。 这样可以加快速度,并且仅在您需要时才会显示弹出列表。

更改DVMSP代码 (Change the DVMSP Code)

To make the pop-up list appear on a double-click, follow these steps to make a couple of simple changes to the code:

要使弹出列表双击显示,请按照以下步骤对代码进行几个简单的更改:

  • On the sheet where you pasted the code, right-click the sheet tab, and click View Code.

    在粘贴代码的工作表上,右键单击工作表选项卡,然后单击“查看代码”。
  • At the top of the code module, click in the blank row above the Private Sub Worksheet_SelectionChange line

    在代码模块的顶部,单击Private Sub Worksheet_SelectionChange行上方的空白行。
Worksheet_SelectionChange code http://blog.contextures.com/
  • At the top right of the window, click the arrow in the Procedures drop down, and click on BeforeDoubleClick

    在窗口的右上角,单击“过程”下拉菜单中的箭头,然后单击“ BeforeDoubleClick”
Worksheet_BeforeDoubleClick code http://blog.contextures.com/
  • Select from the End Sub line, down to the Private Sub Worksheet_SelectionChange line

    从“结束子”行中选择,然后向下到“私人子工作表_选择更改”行
  • Delete those lines

    删除这些行
Delete lines of code http://blog.contextures.com/
  • Scroll down a bit, to the first "Select Case Target.Column" section

    向下滚动到第一个“ Select Case Target.Column”部分
  • Click in the blank line above that section

    单击该部分上方的空白行
  • In the blank line, type: Cancel = True (that turns off the default double-click action, such as entering the cell to edit it)

    在空白行中,键入: Cancel = True (这将关闭默认的双击操作,例如输入要对其进行编辑的单元格)

  • Then, click the Save button, at the top right of the Visual Basic Editor window.

    然后,单击“ Visual Basic编辑器”窗口右上方的“保存”按钮。
Add Cancel = True code http://blog.contextures.com/

获取DVMSP套件 (Get the DVMSP Kit)

If you don't have a copy of my DVMSP kit, you can learn more about it here. You can add this feature to your workbooks, and then use them yourself, or share them with your co-workers. They'll be impressed!

如果没有我的DVMSP套件的副本,可以在此处了解更多信息 。 您可以将此功能添加到您的工作簿,然后自己使用它们,或与您的同事共享。 他们会留下深刻的印象!

了解有关Excel宏的更多信息 (Learn More About Excel Macros)

Closes Sunday, Feb. 7th – Would you like to learn how to save time with Excel macros? Take a look at the free Mini Course on Macros & VBA -- an excellent video series by Jon Acampora, from Excel Campus. Jon’s simple step-by-step approach makes it easy to follow along and learn, so get started now!

2月7日星期日关闭 –您想学习如何使用Excel宏节省时间吗? 观看免费的Macros&VBA迷你课程 -Excel Campus的Jon Acampora的精彩视频系列。 乔恩(Jon)的简单循序渐进方法使后续操作和学习变得容易,因此立即开始!

翻译自: https://contexturesblog.com/archives/2016/02/04/change-excel-vba-code-to-improve-speed/

excel vba代码大全

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/culiao2169/article/details/107987920

智能推荐

linux 内核升级-程序员宅基地

文章浏览阅读841次,点赞28次,收藏9次。centos 7.x 升级内核 3.x 至 5.x

去掉java文件中的注释_利用JavaParser去除java文件中的注释-程序员宅基地

文章浏览阅读922次。利用JavaParser去除java文件中的注释个人博客:记录一下在项目实施过程中的一些点情景回顾之前项目有个需求,就是去掉.java文件中的所有注释,常用的方法是用正则匹配。然而在网络上查找到的正则或多或少都有一些问题,无法匹配到所有的情况。或者说,由于写.java文件的人的不规范(各种奇葩的问题),导致正则覆盖不全。所以正则方法不靠谱,或者说,存在一定的限制。新的想法后来想到利用AST来去除注..._在线java代码去除注释工具

VSCode - 使用VSCode远程连接到Linux并实现免密码登录_vscode连接linux-程序员宅基地

文章浏览阅读3w次,点赞77次,收藏282次。VSCode - Linux - 使用VSCode远程连接到Ubuntu并实现免密登录我使用的是Ubuntu14.04,即便是使用其他发行版也不会影响操作步骤_vscode连接linux

生活随记-腊月第一天-程序员宅基地

文章浏览阅读2.3k次。年底了总是很容易思考人生。出差坐在太原的yd酒店15楼,泡一壶茶翻着书听点音乐,坐在窗边看下空旷冷清的街道。感叹一声,逝者如斯夫不舍昼夜。这一年年过得真快。思考着自己的工作和以后的生活,何去何从。很多事情形成习惯之后就会懒得去改变,逐渐形成一种倦怠。工作,生活,投资也是。也好,今晚就让自己沉浸在无尽交织的思绪中吧。明天睡个懒觉吃个brunch回上海。转眼又到12月了。..._腊月第一天

ftp 下载时防止从缓存中获取文件-程序员宅基地

文章浏览阅读1k次。//http://baike.baidu.com/link?url=QucJiA_Fg_-rJI9D4G4Z4687HG4CfhtmBUd5TlXrcWCeIEXCZxIh0TD7ng1wROAzAuGD8qncM65XK4BZ1K1uqqintCFTP_MFC_TESTDlg::FTP_DownLoadFile(char*FtpIp,char*User,char*Passwor..._ftp 不使用缓存

windows下配置IIS以及优化配置_windows iis-程序员宅基地

文章浏览阅读2.7k次。IIS配置及优化_windows iis

随便推点

linux系统rabbitmq安装步骤_rabbitmq linux安装-程序员宅基地

文章浏览阅读768次。一、安装erlang:1、先下载rpm包:wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm2、rpm包:rpm -Uvh erlang-solutions-1.0-1.noarch.rpm可能会有以下问题:解决办法:(执行以下命令后,在执行上一条命令)yum..._rabbitmq linux安装

CentOS 7 安装最新版Docker教程_centos7安装最新版dockers-程序员宅基地

文章浏览阅读781次。docker安装官方文档:Install Docker Engine on CentOS2、安装提供了工具3、通过添加docker repository如果出现上面的错误提示,可通阿里源进行添加4、安装docker4.1、直接安装最新版本这步完成后可直接跳至启动docker4.2、或者安装指定版本按版本号倒序列出可安装版本列表安装指定版本例如安装20.10.9版本5、启动docker通过进行启动设置docker服务开机启动6、测试7、卸载docker下的_centos7安装最新版dockers

敏感字识别算法基于JDK8 lambada表达式_敏感文本识别算法-程序员宅基地

文章浏览阅读429次。package aaa.bbb.demo;import java.util.ArrayList;import java.util.List;public class RecognitionDemo { public static void main(String[] args) { String str1="SB哈NM哈哈哈WBDhdsada"; String str_敏感文本识别算法

华为鸿蒙系统(Huawei HarmonyOS)

华为鸿蒙系统Huawei HarmonyOS

JS读取粘贴板内容-程序员宅基地

文章浏览阅读4.9k次。1.1 监听onpaste事件1.1.1 定义和用法npaste 事件在用户向元素中粘贴文本时触发。注意:虽然使用的 HTML 元素都支持 onpaste 事件,但实际上并非支持所有元素,例如 <p> 元素, 除非设置了 contenteditable 为 "true" (查看下文的更多实例)。提示:onpaste 事件通常用于 type="text" 的 ..._js 获取粘贴板内容 移动端

Win10系统下软件UI显示不完整解决方案_用苹果设计的ui在win显示不明显-程序员宅基地

文章浏览阅读4.7k次,点赞2次,收藏4次。在最初升级win10的时候就想到了这些问题,例如和各种软件的不兼容性。当然,事实上win10并没有想象的那么糟,作为一个windows user 来说,win10的确是很高大上的,无论是颜值或者是体验,都让人爱不释手。下面我就说一下最近和win10的那些事之一:在win10系统下安装了IBM Cognos Transform后,Transform的一些设计界面不能完全显示,而后我们就是要想办法_用苹果设计的ui在win显示不明显