{"id":129607,"date":"2023-04-05T07:22:34","date_gmt":"2023-04-05T07:22:34","guid":{"rendered":"https:\/\/www.stellarinfo.com\/blog\/?p=129607"},"modified":"2025-11-03T16:51:22","modified_gmt":"2025-11-03T16:51:22","slug":"fix-excel-vba-error-subscript-out-of-range-runtime-error-9","status":"publish","type":"post","link":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/","title":{"rendered":"How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><?xml encoding=\"utf-8\" ?><p>Many users have reported encountering the error &ldquo;Subscript out of range&rdquo; (runtime error 9) when using VBA code in Excel. The error often occurs when the object you are referring to in a code is not available, deleted, or not defined earlier. Sometimes, it occurs if you have declared an array in code but forgot to specify the DIM or ReDIM statement to define the length of array.<\/p><h2 class=\"wp-block-heading\" id=\"causes-of-vba-runtime-error-9:-subscript-out-of-range\"><strong>Causes of VBA Runtime Error 9: Subscript Out Of Range<\/strong><\/h2><p>The error &lsquo;Subscript out of range&rsquo; in Excel can occur due to several reasons, such as:<\/p><ul class=\"wp-block-list\">\n<li>Object you are trying to use in the VBA code is not defined earlier or is deleted.<\/li>\n\n\n\n<li>Entered a wrong declaration syntax of the array.<\/li>\n\n\n\n<li>Wrong spelling of the variable name.<\/li>\n\n\n\n<li>Referenced a wrong array element.<\/li>\n\n\n\n<li>Entered incorrect name of the worksheet you are trying to refer.<\/li>\n\n\n\n<li>Worksheet you trying to call in the code is not available.<\/li>\n\n\n\n<li>Specified an invalid element.<\/li>\n\n\n\n<li>Not specified the number of elements in an array.<\/li>\n\n\n\n<li>Workbook in which you trying to use VBA is corrupted.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"methods-to-fix-excel-vba-error-&lsquo;subscript-out-of-range&rsquo;\"><strong>Methods to Fix Excel VBA Error &lsquo;Subscript out of Range&rsquo;<\/strong><\/h2><p>Following are some workarounds you can try to fix the runtime error 9 in Excel.<\/p><h3 class=\"wp-block-heading\" id=\"h-method-1-check-the-name-of-worksheet-in-the-code\"><strong>Method 1: Check the Name of Worksheet in the Code<\/strong><\/h3><p>Sometimes, Excel throws the runtime error 9: Subscript out of range if the name of the worksheet is not defined correctly in the code. For example &ndash; When trying to copy content from one Excel sheet (emp) to another sheet (emp2) via VBA code, you have mistakenly mentioned wrong name of the worksheet (see the below code).<\/p><pre class=\"wp-block-code command_container\"><code>Private Sub CommandButton1_Click()\nWorksheets(\"emp\").Range(\"A1:E5\").Select\nSelection.Copy\nWorksheets(\"emp3\").Activate\nWorksheets(\"emp3\").Range(\"A1:E5\").Select\nActiveSheet.Paste\nApplication.CutCopyMode = False\nEnd Sub<\/code><\/pre><pre class=\"wp-block-preformatted\"><\/pre><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"623\" height=\"322\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/VBA-error-subscript-out-of-range-when-incorrect-name.jpg\" alt=\"VBA Error Subscript Out Of Range-When Incorrect Name\" class=\"wp-image-130132 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/VBA-error-subscript-out-of-range-when-incorrect-name.jpg 623w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/VBA-error-subscript-out-of-range-when-incorrect-name-300x155.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/VBA-error-subscript-out-of-range-when-incorrect-name-150x78.jpg 150w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/figure><p>When you run the above code, the Excel will throw the Subscript out of range error.<\/p><p>So, check the name of the worksheet and correct it. Here are the steps:<\/p><ul class=\"wp-block-list\">\n<li>Go to the <strong>Design<\/strong> tab in the <strong>Developer<\/strong> section.<\/li>\n\n\n\n<li>Double-click on the <strong>Command<\/strong> button.<\/li>\n\n\n\n<li>Check and modify the worksheet name (e.g. from &ldquo;emp&rdquo; to &ldquo;emp2&rdquo;).<\/li>\n<\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"433\" height=\"191\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/modified-code-from-emp-to-emp2.jpg\" alt=\"Modified Code From emp to emp2\" class=\"wp-image-130133 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/modified-code-from-emp-to-emp2.jpg 433w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/modified-code-from-emp-to-emp2-300x132.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/modified-code-from-emp-to-emp2-150x66.jpg 150w\" sizes=\"auto, (max-width: 433px) 100vw, 433px\" \/><\/figure><ul class=\"wp-block-list\">\n<li>Now run the code.<\/li>\n\n\n\n<li>The content in &lsquo;emp&rsquo; worksheet will be copied to &lsquo;emp2&rsquo; (see below).<\/li>\n<\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"354\" height=\"520\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/content-copied-from-emp-to-emp2.jpg\" alt=\"Content Copied From emp to emp2\" class=\"wp-image-130134 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/content-copied-from-emp-to-emp2.jpg 354w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/content-copied-from-emp-to-emp2-204x300.jpg 204w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/content-copied-from-emp-to-emp2-150x220.jpg 150w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/figure><h3 class=\"wp-block-heading\" id=\"h-method-2-check-the-range-of-the-array\">Method 2: Check the Range of the Array<\/h3><p>The VBA error &ldquo;Subscript out of range&rdquo; also occurs if you have declared an array in a code but didn&rsquo;t specify the number of elements. For example &ndash; If you have declared an array and forgot to declare the array variable with elements, you will get the error (see below):<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"273\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/run-time-error-9-when-not-declared-array.jpg\" alt=\"Runtime Error 9 When Not Declared Array\" class=\"wp-image-130135 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/run-time-error-9-when-not-declared-array.jpg 758w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/run-time-error-9-when-not-declared-array-300x108.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/run-time-error-9-when-not-declared-array-150x54.jpg 150w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/figure><p>To fix this, specify the array variable:<\/p><pre class=\"wp-block-code command_container\"><code>Sub FillArray()\nDim curExpense(364) As Currency\nDim intI As Integer\nFor intI = 0 to 364\ncurExpense(intI) = 20\nNext\nEnd Sub<\/code><\/pre><h3 class=\"wp-block-heading\" id=\"h-method-3-change-macro-security-settings\"><strong>Method 3: Change Macro Security Settings<\/strong><strong><\/strong><\/h3><p>The Runtime error 9: Subscript out of range can also occur if there is an issue with the macros or macros are disabled in the Macro Security Settings. In such a case, you can check and change the macro settings. Follow these steps:<\/p><ul class=\"wp-block-list\">\n<li>Open your Microsoft Excel.<\/li>\n\n\n\n<li>Navigate to <strong>File &gt; Options &gt; Trust Center<\/strong>.<\/li>\n\n\n\n<li>Under <strong>Trust Center<\/strong>, select <strong>Trust Center Settings<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Macro Settings<\/strong>, select <strong>Enable all macros<\/strong>, and then click <strong>OK<\/strong>.<\/li>\n<\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"824\" height=\"543\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/macro-settings-in-trust-center.jpg\" alt=\"Macro Settings In Trust Center\" class=\"wp-image-130136 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/macro-settings-in-trust-center.jpg 824w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/macro-settings-in-trust-center-300x198.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/macro-settings-in-trust-center-768x506.jpg 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/04\/macro-settings-in-trust-center-150x99.jpg 150w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/figure><h3 class=\"wp-block-heading\"><strong>Method 4: Repair your Excel File<\/strong><\/h3><p>The name or format of the Excel file or name of the objects may get changed due to corruption in the file. When the objects are not identified in a VBA code, you may encounter the Subscript out of range error. You can use the Open and Repair utility in Excel to repair the corrupted file. To use this utility, follow these steps:<\/p><ul class=\"wp-block-list\">\n<li>In your MS Excel, click <strong>File &gt; Open<\/strong>.<\/li>\n\n\n\n<li>Browse to the location where the affected file is stored.<\/li>\n\n\n\n<li>In the&nbsp;<strong>Open&nbsp;<\/strong>dialog box, select the corrupted workbook.<\/li>\n\n\n\n<li>In the&nbsp;<strong>Open<\/strong>&nbsp;dropdown, click on&nbsp;<strong>Open and Repair<\/strong>.<\/li>\n\n\n\n<li>You will see a prompt asking you to repair the file or extract data from it.<\/li>\n\n\n\n<li>Click on the <strong>Repair<\/strong> option to extract the data as much as possible. If <strong>Repair<\/strong> button fails, then click <strong>Extract <\/strong>button to recover data without formulas and values.<\/li>\n<\/ul><p>If the &ldquo;Open and Repair&rdquo; utility fails to repair the corrupted\/damaged macro-enabled Excel file, then try an advanced Excel repair tool, such as Stellar Repair for Excel. It can easily repair severely corrupted Excel workbook and recover all the items, including macros, cell comments, table, charts, etc. with 100% integrity. The tool is compatible with all versions of Microsoft Excel.<\/p><h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion<\/strong><\/h2><p>You may experience the &ldquo;Subscript out of range&rdquo; error while using VBA in Excel. You can follow the workarounds discussed in this blog to fix the error. If the Excel file is corrupt, then you can use <a href=\"https:\/\/www.stellarinfo.com\/repair-excel-file.php\" target=\"_blank\" rel=\"noreferrer noopener\">Stellar Repair for Excel<\/a> to repair the file. It&rsquo;s a powerful software that can help fix all the issues that occur due to corruption in the Excel file. It helps to recover all the data from the corrupt Excel files (.xls, .xlsx, .xltm, .xltx, and .xlsm) without changing the original formatting. The tool supports Excel 2021, 2019, 2016, and older versions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many users have reported encountering the error &ldquo;Subscript out of range&rdquo; (runtime&hellip; <a class=\"more-link\" href=\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\">Continue reading <span class=\"screen-reader-text\">How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?<\/span><\/a><\/p>\n","protected":false},"author":82,"featured_media":129617,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-129607","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-file-repair","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range<\/title>\n<meta name=\"description\" content=\"&quot;Subscript Out of Range&quot; error in your Excel VBA code? Don&#039;t panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range\" \/>\n<meta property=\"og:description\" content=\"&quot;Subscript Out of Range&quot; error in your Excel VBA code? Don&#039;t panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\" \/>\n<meta property=\"og:site_name\" content=\"Stellar Data Recovery Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-05T07:22:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-03T16:51:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Monika Dadool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Monika Dadool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\"},\"author\":{\"name\":\"Monika Dadool\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"headline\":\"How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?\",\"datePublished\":\"2023-04-05T07:22:34+00:00\",\"dateModified\":\"2025-11-03T16:51:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\"},\"wordCount\":798,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg\",\"articleSection\":[\"MS Office File Repair\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\",\"name\":\"[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg\",\"datePublished\":\"2023-04-05T07:22:34+00:00\",\"dateModified\":\"2025-11-03T16:51:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"description\":\"\\\"Subscript Out of Range\\\" error in your Excel VBA code? Don't panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg\",\"contentUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg\",\"width\":1000,\"height\":600,\"caption\":\"How To Fix VBA Error Subscript Out Of Range Runtime Error 9\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.stellarinfo.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/\",\"name\":\"Stellar Data Recovery Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\",\"name\":\"Monika Dadool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"caption\":\"Monika Dadool\"},\"description\":\"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/\"],\"url\":\"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range","description":"\"Subscript Out of Range\" error in your Excel VBA code? Don't panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/","og_locale":"en_US","og_type":"article","og_title":"[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range","og_description":"\"Subscript Out of Range\" error in your Excel VBA code? Don't panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.","og_url":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/","og_site_name":"Stellar Data Recovery Blog","article_published_time":"2023-04-05T07:22:34+00:00","article_modified_time":"2025-11-03T16:51:22+00:00","og_image":[{"width":1000,"height":600,"url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg","type":"image\/jpeg"}],"author":"Monika Dadool","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Monika Dadool","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#article","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/"},"author":{"name":"Monika Dadool","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"headline":"How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?","datePublished":"2023-04-05T07:22:34+00:00","dateModified":"2025-11-03T16:51:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/"},"wordCount":798,"commentCount":0,"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg","articleSection":["MS Office File Repair"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/","url":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/","name":"[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage"},"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg","datePublished":"2023-04-05T07:22:34+00:00","dateModified":"2025-11-03T16:51:22+00:00","author":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"description":"\"Subscript Out of Range\" error in your Excel VBA code? Don't panic \u2013 our step-by-step guide will show you how to fix this issue quickly and easily. Follow our expert tips and get back to coding with confidence.","breadcrumb":{"@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#primaryimage","url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg","contentUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2023\/03\/How-to-Fix-VBA-error-Subscript-Out-of-Range-Runtime-Error-9.jpg","width":1000,"height":600,"caption":"How To Fix VBA Error Subscript Out Of Range Runtime Error 9"},{"@type":"BreadcrumbList","@id":"https:\/\/www.stellarinfo.com\/blog\/fix-excel-vba-error-subscript-out-of-range-runtime-error-9\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.stellarinfo.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Fix Excel VBA Error &#8220;Subscript Out of Range&#8221; (Runtime Error 9)?"}]},{"@type":"WebSite","@id":"https:\/\/www.stellarinfo.com\/blog\/#website","url":"https:\/\/www.stellarinfo.com\/blog\/","name":"Stellar Data Recovery Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd","name":"Monika Dadool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","caption":"Monika Dadool"},"description":"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.","sameAs":["https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/"],"url":"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/"}]}},"_links":{"self":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/129607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/comments?post=129607"}],"version-history":[{"count":5,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/129607\/revisions"}],"predecessor-version":[{"id":130141,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/129607\/revisions\/130141"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media\/129617"}],"wp:attachment":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media?parent=129607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/categories?post=129607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/tags?post=129607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}