{"id":634,"date":"2024-12-02T02:36:17","date_gmt":"2024-12-02T02:36:17","guid":{"rendered":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/02\/cach-chen-va-chay-ma-vba-trong-excel-2010-2016-huong-dan-cho-nguoi-moi-bat-dau\/"},"modified":"2024-12-02T02:36:17","modified_gmt":"2024-12-02T02:36:17","slug":"cach-chen-va-chay-ma-vba-trong-excel-2010-2016-huong-dan-cho-nguoi-moi-bat-dau","status":"publish","type":"post","link":"https:\/\/blog.ezworkapp.com\/index.php\/2024\/12\/02\/cach-chen-va-chay-ma-vba-trong-excel-2010-2016-huong-dan-cho-nguoi-moi-bat-dau\/","title":{"rendered":"C\u00e1ch ch\u00e8n v\u00e0 ch\u1ea1y m\u00e3 VBA trong Excel 2010-2016, h\u01b0\u1edbng d\u1eabn cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u"},"content":{"rendered":"<div class=\"uk-panel uk-margin\" id=\"template-dQf5b79p#1\">\n<p style=\"text-align: justify\">Trong b\u00e0i vi\u1ebft n\u00e0y, Blog H\u1ecdc Excel Online s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n t\u1eebng b\u01b0\u1edbc c\u00e1ch th\u00eam m\u00e3 VBA (Visual Basic for Applications code) v\u00e0o b\u1ea3ng t\u00ednh Excel v\u00e0 ch\u1ea1y ch\u01b0\u01a1ng tr\u00ecnh n\u00e0y \u0111\u1ec3 th\u1ef1c hi\u1ec7n nh\u1eefng nhi\u1ec7m v\u1ee5 tr\u00ean trang t\u00ednh m\u00f4\u0323t ca\u0301ch \u0111\u01a1n gia\u0309n nh\u00e2\u0301t giu\u0301p cho ca\u0301c ba\u0323n co\u0301 th\u00ea\u0309 <a href=\"http:\/\/blog.ezworkapp.com\">ho\u0323c Excel ta\u0323i nha\u0300<\/a>, t\u1ef1 h\u1ecdc VBA hi\u00ea\u0323u qua\u0309 nh\u00e2\u0301t.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_61 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\">Xem nhanh<\/p>\n<p><label for=\"ez-toc-cssicon-toggle-item-674d1d202cabf\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><\/span><\/span><\/label><\/p>\n<nav>\n<ul class=\"ez-toc-list ez-toc-list-level-1 \">\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.hocexcel.online\/cach-chen-va-chay-ma-vba-trong-excel-2010-2016-huong-dan-cho-nguoi-moi-bat-dau.html#Chen_ma_VBA_vao_bang_tinh_Excel\" title=\"Ch\u00e8n m\u00e3 VBA v\u00e0o b\u1ea3ng t\u00ednh Excel:\">Ch\u00e8n m\u00e3 VBA v\u00e0o b\u1ea3ng t\u00ednh Excel:<\/a><\/li>\n<li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.hocexcel.online\/cach-chen-va-chay-ma-vba-trong-excel-2010-2016-huong-dan-cho-nguoi-moi-bat-dau.html#Cach_chay_ma_VBA_macros_trong_Excel\" title=\"C\u00e1ch ch\u1ea1y m\u00e3 VBA macros trong Excel:\">C\u00e1ch ch\u1ea1y m\u00e3 VBA macros trong Excel:<\/a><\/li>\n<\/ul>\n<\/nav>\n<\/div>\n<h2 style=\"text-align: justify\"><span class=\"ez-toc-section\" id=\"Chen_ma_VBA_vao_bang_tinh_Excel\"><\/span><strong>Ch\u00e8n m\u00e3 VBA v\u00e0o b\u1ea3ng t\u00ednh Excel:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify\">Trong v\u00ed d\u1ee5 n\u00e0y, ch\u00fang ta s\u1ebd s\u1eed d\u1ee5ng <strong>macro VBA <\/strong>\u0111\u1ec3 x\u00f3a c\u00e1ch d\u00f2ng t\u1eeb trang t\u00ednh hi\u1ec7n t\u1ea1i.<\/p>\n<ol style=\"text-align: justify\">\n<li>M\u1edf b\u1ea3ng t\u00ednh trong Excel.<\/li>\n<li>Nh\u1ea5n <strong><em>Alt + F11 <\/em><\/strong>\u0111\u1ec3 m\u1edf <strong><em>VBA<\/em><\/strong>.<\/li>\n<\/ol>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5683\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/excel-dialog-box-launcher-1-44.png\" width=\"600\" height=\"426\" title=\"excel-dialog-box-launcher-1-44\"><\/p>\n<ol style=\"text-align: justify\" start=\"3\">\n<li>Nh\u1ea5p ph\u1ea3i v\u00e0o t\u00ean b\u1ea3ng t\u00ednh trong b\u1ea3ng <strong><em>Project-VBAProject<\/em><\/strong> (n\u1eb1m \u1edf g\u00f3c tr\u00ean b\u00ean tr\u00e1i c\u1ee7a c\u1eeda s\u1ed5 ch\u1ec9nh s\u1eeda) v\u00e0 ch\u1ecdn <strong><em>Insert &gt; Module <\/em><\/strong>t\u1eeb danh s\u00e1ch t\u00f9y ch\u1ecdn.<\/li>\n<\/ol>\n<p style=\"text-align: justify\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/insert-vba-module.png\" alt=\"Insert a new VBA module to the Excel workbook\" title=\"insert-vba-module\"><\/p>\n<ol style=\"text-align: justify\" start=\"4\">\n<li>Sao ch\u00e9p m\u00e3 <strong><em>VBA <\/em><\/strong>(t\u1eeb trang web) v\u00e0 d\u00e1n n\u00f3 v\u00e0o b\u00ean ph\u1ea3i b\u1ea3ng ch\u1ec9nh s\u1eeda VBA (c\u1eeda s\u1ed5 Module1)<\/li>\n<\/ol>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5684 aligncenter\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/excel-dialog-box-launcher-1-45.png\" width=\"600\" height=\"331\" title=\"excel-dialog-box-launcher-1-45\"><\/p>\n<p style=\"text-align: justify\"><strong>Ch\u00fa \u00fd. C\u00e1ch t\u0103ng t\u1ed1c ch\u1ea1y m\u00e3 macro<\/strong><\/p>\n<p style=\"text-align: justify\">N\u1ebfu m\u00e3 <strong><em>VBA Macro <\/em><\/strong>kh\u00f4ng ch\u1ee9a nh\u1eefng d\u00f2ng sau \u0111\u00e2y trong ph\u1ea7n m\u1edf \u0111\u1ea7u:<\/p>\n<div class=\"code-block code-block-2\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/vba101-tu-dong-hoa-excel-voi-lap-trinh-vba-cho-nguoi-moi-bat-dau\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/vba101_92019-nho-10.gif\" title=\"vba101_92019-nho-10\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<div class=\"code-block code-block-1\" style=\"margin: 8px 0;clear: both\">\n<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/ex101-excel-tu-co-ban-den-chuyen-gia-danh-cho-nguoi-di-lam\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/ex101_92019-nho-33.gif\" title=\"ex101_92019-nho-33\"><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p style=\"text-align: justify\"><em>Application.ScreenUpdating = False<\/em><\/p>\n<p style=\"text-align: justify\"><em>Application.Calculation = xlCalculationManual<\/em><\/p>\n<blockquote>\n<p style=\"text-align: justify\">Xem th\u00eam: T\u00e0i li\u1ec7u t\u1ed5ng h\u1ee3p <a href=\"http:\/\/blog.ezworkapp.com\/tag\/excel-2010\">h\u1ecdc Excel 2010<\/a><\/p>\n<\/blockquote>\n<ol style=\"text-align: justify\" start=\"5\">\n<li>Sau \u0111\u00f3 th\u00eam nh\u1eefng d\u00f2ng sau \u0111\u1ec3 m\u00e3 macro c\u1ee7a b\u1ea1n ho\u1ea1t \u0111\u1ed9ng nhanh h\u01a1n (xem h\u00ecnh minh h\u1ecda tr\u00ean)<\/li>\n<\/ol>\n<p style=\"text-align: justify\">Sau ph\u1ea7n m\u1edf \u0111\u1ea7u c\u1ee7a m\u00e3 l\u1eadp tr\u00ecnh, t\u1ea5t c\u1ea3 nh\u1eefng d\u00f2ng m\u00e3 sau \u0111\u1ec1u b\u1eaft \u0111\u1ea7u b\u1eb1ng <strong><em>Dim <\/em><\/strong>(n\u1ebfu kh\u00f4ng c\u00f3 d\u00f2ng Dim, h\u00e3y th\u00eam ch\u00fang v\u00e0o ngay b\u00ean ph\u1ea3i d\u00f2ng <strong><em>Sub line<\/em><\/strong>):<\/p>\n<p style=\"text-align: justify\"><em>Application.ScreenUpdating = False<\/em><\/p>\n<p style=\"text-align: justify\"><em>Application.Calculation = xlCalculationManual<\/em><\/p>\n<p style=\"text-align: justify\">V\u1edbi nh\u1eefng d\u00f2ng code tr\u01b0\u1edbc <strong><em>End Sub<\/em><\/strong>:<\/p>\n<p style=\"text-align: justify\"><em>Application.ScreenUpdating = True<\/em><\/p>\n<p style=\"text-align: justify\"><em>Application.Calculation = xlCalculationAutomatic<\/em><\/p>\n<blockquote>\n<p style=\"text-align: justify\">Xem th\u00eam:\u00a0<a href=\"http:\/\/blog.ezworkapp.com\/bat-dau-voi-excel-macros-va-lap-trinh-vba.html\">B\u1eaft \u0111\u1ea7u v\u1edbi Excel Macros v\u00e0 l\u1eadp tr\u00ecnh VBA<\/a><\/p>\n<\/blockquote>\n<p style=\"text-align: justify\">Nh\u1eefng d\u00f2ng n\u00e0y, nh\u01b0 t\u00ean c\u1ee7a ch\u00fang, s\u1ebd t\u1eaft m\u00e0n h\u00ecnh \u0111\u1ec3 l\u00e0m m\u1edbi v\u00e0 t\u00ednh to\u00e1n l\u1ea1i c\u00e1c c\u00f4ng th\u1ee9c trong b\u1ea3ng t\u00ednh tr\u01b0\u1edbc khi ch\u1ea1y m\u00e3 <strong><em>Macro.<\/em><\/strong><\/p>\n<p style=\"text-align: justify\">Sau khi ch\u1ea1y ch\u01b0\u01a1ng tr\u00ecnh, m\u1ecdi th\u1ee9 s\u1ebd \u0111\u01b0\u1ee3c b\u1eadt l\u1ea1i. K\u1ebft qu\u1ea3 l\u00e0, t\u1ed1c \u0111\u1ed9 ch\u1ea1y m\u00e3 s\u1ebd t\u0103ng 10% t\u1edbi 500%.<\/p>\n<p style=\"text-align: justify\">L\u01b0u b\u1ea3ng t\u00ednh c\u1ee7a b\u1ea1n d\u01b0\u1edbi t\u00ean \u201cExcel macro-enabled workbook\u201d. Nh\u1ea5n <strong><em>Ctrl + S<\/em><\/strong>, sau \u0111\u00f3 nh\u1ea5p v\u00e0o n\u00fat <strong><em>No <\/em><\/strong>trong h\u1ed9p tho\u1ea1i c\u1ea3nh b\u00e1o <strong><em>\u201cThe following features cannot be saved in macro-free workbook\u201d<\/em><\/strong>.<\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5686\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/excel-dialog-box-launcher-1-47.png\" width=\"600\" height=\"169\" title=\"excel-dialog-box-launcher-1-47\"><\/p>\n<p style=\"text-align: justify\">H\u1ed9p tho\u1ea1i <strong><em>Save As<\/em><\/strong> s\u1ebd m\u1edf ra. Ch\u1ecdn <em>\u201cExcel macro-enabled workbook\u201d<\/em> t\u1eeb danh s\u00e1ch t\u00f9y ch\u1ecdn <strong><em>Save as type<\/em><\/strong> v\u00e0 nh\u1ea5n n\u00fat <strong><em>Save<\/em><\/strong>.<\/p>\n<p style=\"text-align: justify\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5687\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/excel-dialog-box-launcher-1-48.png\" width=\"600\" height=\"449\" title=\"excel-dialog-box-launcher-1-48\"><\/p>\n<p style=\"text-align: justify\">Nh\u1ea5n <strong><em>Alt + Q<\/em><\/strong> \u0111\u1ec3 \u0111\u00f3ng c\u1eeda s\u1ed5 s\u1eeda \u0111\u1ed5i v\u00e0 tr\u1edf l\u1ea1i v\u1edbi b\u1ea3ng t\u00ednh c\u1ee7a b\u1ea1n.<\/p>\n<h2 style=\"text-align: justify\"><span class=\"ez-toc-section\" id=\"Cach_chay_ma_VBA_macros_trong_Excel\"><\/span><strong>C\u00e1ch ch\u1ea1y m\u00e3 VBA macros trong Excel:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify\">Khi b\u1ea1n mu\u1ed1n ch\u1ea1y m\u00e3 VBA m\u00e0 b\u1ea1n v\u1eeba th\u00eam v\u00e0o trong ph\u1ea7n tr\u00ean, nh\u1ea5n <strong><em>Alt + F8 <\/em><\/strong>\u0111\u1ec3 m\u1edf h\u1ed9p tho\u1ea1i <strong><em>Macro<\/em><\/strong>.<\/p>\n<p style=\"text-align: justify\">Sau \u0111\u00f3 ch\u1ecdn <strong><em>macro <\/em><\/strong>b\u1ea1n mu\u1ed1n t\u1eeb danh s\u00e1ch <strong><em>Macro Name<\/em><\/strong>: v\u00e0 nh\u1ea5p v\u00e0o n\u00fat <strong><em>Run<\/em><\/strong>.<\/p>\n<p style=\"text-align: justify\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/run-vba-macro.png\" alt=\"Press Alt+F8 to run the VBA macro\" title=\"run-vba-macro\"><\/p>\n<p>Hy v\u1ecdng r\u1eb1ng qua b\u00e0i vi\u1ebft n\u00e0y b\u1ea1n \u0111\u00e3 bi\u1ebft c\u00e1ch \u0111\u1ec3 c\u00f3 th\u1ec3 b\u1eaft \u0111\u1ea7u t\u1ef1 h\u1ecdc VBA v\u00e0 s\u1eed d\u1ee5ng VBA trong c\u00f4ng vi\u1ec7c c\u1ee7a m\u00ecnh.<\/p>\n<p>VBA\u00a0gi\u00fap \u00edch\u00a0r\u1ea5t nhi\u1ec1u trong c\u00f4ng vi\u1ec7c: gi\u00fap b\u1ea1n t\u0103ng t\u1ed1c trong qu\u00e1 tr\u00ecnh x\u1eed l\u00fd tr\u00ean excel, gi\u00fap l\u1eadp c\u00e1c b\u00e1o c\u00e1o t\u1ef1 \u0111\u1ed9ng, \u0111i\u1ec1u khi\u1ec3n c\u00e1c ch\u01b0\u01a1ng tr\u00ecnh kh\u00e1c nh\u01b0 word, power point, outlook\u2026 gi\u00fap bi\u1ebfn file excel c\u1ee7a b\u1ea1n tr\u1edf th\u00e0nh 1 ph\u1ea7n m\u1ec1m chuy\u00ean nghi\u1ec7p\u2026<\/p>\n<p>\u0110\u1ec3 c\u00f3 th\u1ec3 h\u1ecdc VBA m\u1ed9t c\u00e1ch \u0111\u1ea7y \u0111\u1ee7, c\u00f3 h\u1ec7 th\u1ed1ng, b\u1ea1n h\u00e3y tham gia kho\u00e1 h\u1ecdc\u00a0<a href=\"https:\/\/hocexcel.online\/course\/preview\/vba101-tu-dong-hoa-excel-voi-lap-trinh-vba-cho-nguoi-moi-bat-dau\">VBA101 \u2013 VBA c\u01a1 b\u1ea3n d\u00e0nh cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u<\/a> c\u1ee7a h\u1ec7 th\u1ed1ng H\u1ecdc Excel Online. Hi\u1ec7n nay h\u1ec7 th\u1ed1ng \u0111ang c\u00f3 nhi\u1ec1u \u01b0u \u0111\u00e3i khi b\u1ea1n \u0111\u0103ng k\u00fd kh\u00f3a h\u1ecdc n\u00e0y. Chi ti\u1ebft xem t\u1ea1i <a href=\"https:\/\/hocexcel.online\/course\/preview\/vba101-tu-dong-hoa-excel-voi-lap-trinh-vba-cho-nguoi-moi-bat-dau\">kho\u00e1 h\u1ecdc VBA<\/a><\/p>\n<\/div>\n<div class=\"uk-panel uk-margin uk-width-xlarge\">\n<p>Click \u0111\u0103ng k\u00fd h\u1ecdc t\u1ea1i:<\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/khoa-hoc\" target=\"_blank\" rel=\"noopener\">T\u1ea5t c\u1ea3 kho\u00e1 h\u1ecdc\u00a0<span>\ud83d\udcd6<\/span><\/a><\/p>\n<p><a href=\"http:\/\/blog.ezworkapp.com\/huong-dan-kich-hoat-khoa-hoc-tai-hoc-excel-online.html\" target=\"_blank\" rel=\"noopener\">H\u01b0\u1edbng d\u1eabn k\u00edch ho\u1ea1t<\/a><\/p>\n<p>HKD H\u1ecdc Excel Online<br \/>S\u1ed1 \u0110K: 17A80048102<\/p>\n<\/div>\n<div class=\"uk-panel uk-text-small uk-margin uk-margin-remove-bottom uk-text-center\">\n<p>\u00a9  document.currentScript.insertAdjacentHTML(&#8216;afterend&#8217;, &#8221; + new Intl.DateTimeFormat(document.documentElement.lang, {year: &#8216;numeric&#8217;}).format() + &#8221;);  H\u1ecdc Excel Online. All rights reserved.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"ad-inserterpro\">\n<a href=\"https:\/\/hocexcel.online\/course\/preview\/vba101-tu-dong-hoa-excel-voi-lap-trinh-vba-cho-nguoi-moi-bat-dau\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/blog.ezworkapp.com\/wp-content\/uploads\/2024\/12\/vba101_92019-nho-10.gif\"><br \/>\n<\/a>\n<\/div>\n","protected":false},"author":1,"featured_media":635,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-nang-cao"],"_links":{"self":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/comments?post=634"}],"version-history":[{"count":0,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/posts\/634\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media\/635"}],"wp:attachment":[{"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/media?parent=634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/categories?post=634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ezworkapp.com\/index.php\/wp-json\/wp\/v2\/tags?post=634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}