[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-574349-105":53,"doc-detail-574349-en":127,"doc-similar-574349":149},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","vba-cheat-sheets-sheets-vba-examples","VBA Cheat Sheets - Sheets - VBA examples","","VBA Cheat Sheets provides concise, ready-to-copy macros covering common Excel automation tasks. It lists practical commands for activating and selecting sheets, managing rows, columns, cells, and ranges, and performing typical actions like copy, cut, insert, delete, clear, and merge operations. The sheet also includes workbook-level operations such as open, close, save, protect/unprotect, and error-handling patterns using On Error statements. Additional sections address file and folder operations via FileCopy, Kill, MkDir, and Dir.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/vba-cheat-sheets-sheets-vba-examples/574349/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/vba-cheat-sheets-sheets-vba-examples/574349.png","ImageObject",442,249,{"name":88,"@type":89},"Anna Hans","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-12-02","2026-10-14",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",7,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do I activate a specific worksheet in VBA?","Question",{"text":109,"@type":110},"Use Sheets(\"Input\").Activate to activate by tab name, or Sheet1.Activate to activate by VBA code name. You can also activate by index with Sheets(1).Activate.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What VBA code is commonly used to protect and unprotect a worksheet?",{"text":114,"@type":110},"Unprotect with Sheets(\"Sheet1\").Unprotect, optionally supplying a password. Protect with Sheets(\"Sheet1\").Protect, and to limit access you can use UserInterfaceOnly:=True.",{"name":116,"@type":107,"acceptedAnswer":117},"How does the cheat sheet handle VBA errors?",{"text":118,"@type":110},"It uses On Error GoTo 0 to stop and display errors, On Error Resume Next to skip errors, and Err.Number / Err.Description with MsgBox to show error details. It also includes Err.Raise for generating custom errors.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},574349,1792007932,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":126,"read_time":9,"preview_page_count":73,"preview_urls":140},5909892332657,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","VBA CHEAT SHEETS  \nSHEETS  \n\n| Description | VBA Code |\n| --- | --- |\n| Activate by Tab Name | Sheets(“Input”).Activate |\n| Activate by VBA Code Name | Sheet1.Activate |\n| Activate by Index Position | Sheets(1).Activate |\n| Next Sheet | ActiveSheet.Next.Activate |\n| Get ActiveSheet | MsgBox ActiveSheet.Name |\n| Select Sheet | Sheets(“Input”).Select |\n| Set to Variable | Dim ws as Worksheet\u003Cbr>Set ws = ActiveSheet |\n| Name / Rename | ActiveSheet. Name = “NewName” |\n| Add Sheet | Sheets.Add |\n| Add Sheet and Name | Sheets.Add. Name = “NewSheet” |\n| Add Sheet to Variable | Dim ws As Worksheet Set ws = Sheets.Add |\n| Copy Sheet | Sheets(“Sheet1”).Copy\u003Cbr>Before:=Sheets(“Sheet2”) |\n| Hide Sheet | Sheets(“Sheet1”) .visible = False\u003Cbr>or\u003Cbr>Sheets(“Sheet1”) .visible = xlSheetHidden |\n| Unhide Sheet | Sheets(“Sheet1”) .Visible = True\u003Cbr>or\u003Cbr>Sheets(“Sheet1”) .Visible = xlSheetVisible |\n| Very Hide Sheet | Sheets(“Sheet1”) .Visible =\u003Cbr>xlSheetVeryHidden |\n| Delete Sheet | Sheets(“Sheet1”).Delete |\n| Clear Sheet | Sheets(“Sheet1”).Cells.Clear |\n| Unprotect (No Password) | Sheets(“Sheet1”).Unprotect |\n| Unprotect (Password) | Sheets(“Sheet1”) . Unprotect “Password” |\n| Protect (No\u003Cbr>Password) | Sheets(“Sheet1”).Protect |\n| Protect (Password) | Sheets(“Sheet1”) . Protect “Password” |\n| Protect but Allow VBA Access | Sheets(“Sheet1”).Protect\u003Cbr>UserInterfaceOnly:=True |\n\nROWS  \n\n| Description | VBA Code |\n| --- | --- |\n| Activate | Rows(1).Activate\u003Cbr>Rows(“1:1”).Activate\u003Cbr>Range(“a1”).EntireRow.Activate |\n| Height / Width | Range(“A1”) . EntireRow. RowHeight = 30 |\n| Delete | Range(“A1”).EntireRow.Delete |\n| Count | Range(“A1”).Rows.Count |\n| Insert | Range(“A1”).EntireRow.Inser |\n| Last | dim lRow as long\u003Cbr>lRow = Cells(Rows.Count, 1) . End(xlUp) . Row |\n| Copy | Range(“1:1”).Copy Range(“5:5”) |\n| Insert | Range(“1:1”).Copy\u003Cbr>Range(“5:5”).Insert |\n\nCELLS & RANGES  \n\n| Description | VBA Code |\n| --- | --- |\n| Activate Cell | Range(“B3”).Activate Cells(3,2).Activate |\n| Select Range | Range(“a1:a3”).Select Range(Range(“a1”), Range(“a3”)) .Select Range(Cells(1, 1), Cells(3, 1)) .Select |\n| Resize | Range(“B3”).Resize(2, 2).Select |\n| Offset | Range(“B3”).Offset(2, 2).Select |\n| Copy | Range(“A1:B3”).Copy Range(“D1”) |\n| Cut | Range(“A1:B3”).Cut Range(“D1”) |\n| Delete | Range(“A1:B3”).Delete\u003Cbr>Range(“A1:B3”) . Delete shift:=xlShiftToLeft |\n| Clear | Range(“A1:A3”).Clear\u003Cbr>Range(“A1:A3”).ClearContents Range(“A1:A3”).ClearFormat |\n| Count | Range(“A1:A3”).Count |\n| Set to Variable | Dim rng as Range Set rng = Range(“A1”) |\n| Merge/UnMerge | Range(“A1:A3”).Merge\u003Cbr>Range(“A1:A3”).UnMerge |\n| Loop Through Cells | Dim cell As Range\u003Cbr>For Each cell In Range(“A1:C3”) MsgBox cell.Value\u003Cbr>Next cell |\n\nCOLUMNS  \n\n| Description | VBA Code\u003Cbr>Columns(1).Activate\u003Cbr>Columns(“a:a”).Activate\u003Cbr>Range(“a1”).EntireColumn.Activate |\n| --- | --- |\n| Activate |  |\n| Height / Width | Range(“A1”) . EntireColumn.\u003Cbr>ColumnWidth = 30 |\n| Delete | Range(“A1”).EntireColumn.Delete |\n| Count | Range(“A1”).Columns.Count |\n| Insert | Range(“A1”).EntireColumn.Insert |\n| Last | dim lCol as long\u003Cbr>lCol = Cells(1, Columns.Count) . End (xlToLeft).Column |\n| Copy | Range(“A:A”).Copy Range(“E:E”) |\n| Insert | Range(“A:A”).Copy\u003Cbr>Range(“E:E”).Insert |\n\nERRORS  \n\n| Description | VBA Code |\n| --- | --- |\n| On Error – Stop\u003Cbr>code and display error | On Error Goto 0 |\n| On Error – Skip error and continue running | On Error Resume Next |\n| On Error – Goto a line of code [Label] | On Error Goto [Label] |\n| Clears (Resets) Error | On Error GoTo –1 |\n| Show Error number | MsgBox Err. Number |\n| Show Description of error | MsgBox Err. Description |\n| Function to gen\u003Cbr>erate own error | Err.Raise |\n\nAutoMacro:  \nVBA Add-in with Hundreds of Ready-To-Use Code Examples, Code Generators, and much more!  \nLearn More  \nWORKBOOKS  \n\n| Description | VBA Code |\n| --- | --- |\n| Activate | Workbooks(“Book1”).Activate |\n| Activate First Opened | Workbooks(1).Activate |\n| Activate Last O","cbCaiqGLbUpcLvmb","https://ap.wps.com/l/cbCaiqGLbUpcLvmb","pdf",133248,"English","# Sheets\n## Rows\n## Cells & Ranges\n## Columns\n## Errors\n## Workbooks\n## Files\n## Settings","[{\"question\":\"How do I activate a specific worksheet in VBA?\",\"answer\":\"Use Sheets(\\\"Input\\\").Activate to activate by tab name, or Sheet1.Activate to activate by VBA code name. You can also activate by index with Sheets(1).Activate.\"},{\"question\":\"What VBA code is commonly used to protect and unprotect a worksheet?\",\"answer\":\"Unprotect with Sheets(\\\"Sheet1\\\").Unprotect, optionally supplying a password. Protect with Sheets(\\\"Sheet1\\\").Protect, and to limit access you can use UserInterfaceOnly:=True.\"},{\"question\":\"How does the cheat sheet handle VBA errors?\",\"answer\":\"It uses On Error GoTo 0 to stop and display errors, On Error Resume Next to skip errors, and Err.Number / Err.Description with MsgBox to show error details. It also includes Err.Raise for generating custom errors.\"}]","VBA Cheat Sheets - Sheets - VBA examples | PDF",[141,145],{"page_no":9,"url":142,"width":143,"height":144},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/23436e977262f2f4208fda6054b6e5aa.webp",983,1272,{"page_no":73,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/bb433a6c1851cc0055c51a1bf3972036.webp",982,1270,{"list":150,"token":60},[151,158,164,171,177,184,190,197,203,210],{"doc_id":152,"doc_title":153,"file_type":134,"home_preview_img_url":154,"slug":155,"view_count":156,"category_name":11,"create_tm":157},572970,"Windows CMD Commands Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950588441/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=CGNL9fX6YkdM80%2BXcaQEAMMap1g%3D","windows-cmd-commands-cheat-sheet",22,1791930313,{"doc_id":159,"doc_title":160,"file_type":134,"home_preview_img_url":161,"slug":162,"view_count":45,"category_name":11,"create_tm":163},572306,"Command Line Cheat Sheets - Windows Command Line (CMD) Essentials Cheat Sheet - PowerShell Essentials Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950574353/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=IyPN6NvObdM5CMH3dobRmupbZL8%3D","command-line-cheat-sheets-windows-command-line-cmd-essentials-cheat-sheet-powershell-essentials-cheat-sheet",1791926658,{"doc_id":165,"doc_title":166,"file_type":134,"home_preview_img_url":167,"slug":168,"view_count":169,"category_name":11,"create_tm":170},572972,"boogie_windows-command-line-basic - Windows Command Line Basic Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950750685/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=3GLc8DwE0wxWoCz2paYgNxvsmDE%3D","boogie_windows-command-line-basic-windows-command-line-basic-cheat-sheet",23,1791930318,{"doc_id":172,"doc_title":173,"file_type":134,"home_preview_img_url":174,"slug":175,"view_count":35,"category_name":11,"create_tm":176},572971,"Command-Line Cheat Sheet - Version Control","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950588438/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=35Hb26LUItrNxRZF44zyUQTz4lU%3D","command-line-cheat-sheet-version-control",1791930314,{"doc_id":178,"doc_title":179,"file_type":134,"home_preview_img_url":180,"slug":181,"view_count":182,"category_name":11,"create_tm":183},571691,"Excel Mac Shortcut Keys - Action Keystrokes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950723468/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=CnjZYyU2f7YnxNc3t65pL4JbI60%3D","excel-mac-shortcut-keys-action-keystrokes",27,1791923153,{"doc_id":185,"doc_title":186,"file_type":134,"home_preview_img_url":187,"slug":188,"view_count":156,"category_name":11,"create_tm":189},571621,"Microsoft Excel 2013 All-in-One Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950722294/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=DjzvYPr648M1RgT0xsshZYx%2FShM%3D","microsoft-excel-2013-all-in-one-cheat-sheet",1791922770,{"doc_id":191,"doc_title":192,"file_type":134,"home_preview_img_url":193,"slug":194,"view_count":195,"category_name":11,"create_tm":196},573203,"Vim Quick Reference Card - read online free","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950606362/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=gqKjB5vEFjytwDPLIuoGBjWtL1w%3D","vim-quick-reference-card-read-online-free",13,1791934476,{"doc_id":198,"doc_title":199,"file_type":134,"home_preview_img_url":200,"slug":201,"view_count":35,"category_name":11,"create_tm":202},240778,"Brandon - Gardner Documentation and Improvements on a Flight Safety Risk Analysis Tool - 1","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229894498069/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=pZbhzy%2BrR%2FrD%2BCNqLNBkEPk87DQ%3D","brandon-gardner-documentation-and-improvements-on-a-flight-safety-risk-analysis-tool-1",1789165646,{"doc_id":204,"doc_title":205,"file_type":134,"home_preview_img_url":206,"slug":207,"view_count":208,"category_name":11,"create_tm":209},572769,"SQL Examples - SQL Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950584013/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=znoKv4rc1aUsM4WfodMBObrmiwA%3D","sql-examples-sql-cheat-sheet",24,1791929200,{"doc_id":211,"doc_title":212,"file_type":134,"home_preview_img_url":213,"slug":214,"view_count":40,"category_name":11,"create_tm":215},573357,"All Cheat Sheets - Maven & Git & Java Collections","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950820400/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796524499&Signature=9NdM0IvlP6U2JHnBsNslLXFa7wQ%3D","all-cheat-sheets-maven-git-java-collections",1791937856]