subscript out of range

  1. R

    Subscript out of range error when opening another workbook

    Hi, For my job I made a pretty big workbook doing a whole lot of calculations and everything is working as it should but I run into a problem when I try opening other workbooks alongside it. For some reason, when I open another workbook with or without any VBA-code in it, the private...
  2. N

    How to copy a range from 1 workbook to a new workbook and avoid subscript out of range error

    I am trying to copy a range from 1 workbook to a new workbook, but I keep getting subscript out of range and I don't know how to fix it. The workbook still has no name, since I still have not saved it, since I am going to save it until all my code executes. Any help will be greatly apperciated...
  3. A

    Subscript out of Range Error when opening Excel 97-2003 Workbook

    I am trying to open a Excel 97-2003 file that contains macros. For some reason when I do so, it opens it but immediately says "subscript out of range". I know my syntax is correct because it works perfectly fine when I open any other macro filled excel file. I have double checked my Trust Center...
  4. A

    Run time error 9: subscript out of range when opening a workbook in VBA

    I am trying to open a new workbook in VBA. I have pasted the relevant part of my code below. I'm new to VBA so bare with me :) I have tried various .open formats, but each time I get the same run time error. The file I am trying to open is a Excel 97-2003 file (contains macros). Any help would...
  5. M

    "Subscript out of range" error when using variables as worksheet reference

    Hi. I have been using excel macro as below and experiencing "Runtime error 9: Subscript out of range" error. It happens only when I use a variable to reference a worksheet within a workbook.
  6. S

    Why is windows.activate subscript out of range (error 9)?

    I am trying to activate a window that I have just opened. My code is as follows: Dim quarter As Integer Dim yr As Integer yr = InputBox("Enter the year:", "Year") quarter = InputBox("Enter the quarter (just the number):", "Quarter") If quarter <> 1 Then...
  7. I

    Macro Runtime Error 9: subscript out of range

    Hi, Disclaimer: I am using Excel 365 and I have zero programming knowledge or experience. Today I used Macros for the first time and recorded a Macro to pull bank fixed deposit rates from a bank website and input data from this table to another one. But when I run this Macro, I get a Runtime...
  8. I

    VBA code to identify one open workbook only working when certain workbook is open in a specific order?

    Hello. So I have this VBA code to identify two open workbooks and match data across them. One is Routing. One is Pickorder. This one is a unique name daily but always has PickOrder in it along with the current date. When this code is run a third workbook is open (not part of code). However when...
  9. T

    VBA Code Error

    Hello, Let me start by saying that I am very new to VBA coding, so I'm sure I am making a simple mistake. I found similar questions to this on the forum, but none had exactly what I'm looking for. I have a document that is updated daily to track certain progress in my work team. I have...
  10. Rymare

    Subscript out of Range Error

    I keep getting a subscript out of range error when I run this code Private Sub CommandButton1_Click() Dim file_path As String Dim xlApp As Excel.Application Set xlApp = CreateObject("Excel.Application") file_path = FileSelectBox("*.xlsx") xlApp.Visible = True 'xlApp.Workbooks.Open...
  11. S

    Subscript of our range

    Hi, Im writing some code to calculate daily, monthly and annual realised volatlity. ( I know i can do this with stdev but for what i want to use it for i want a manual calc.) I keep getting "subscript out of range" error once it goes beyond my last cell in the monthly calcluation Any ideas...
  12. R


    Hello all, I am trying to import data from a network file to update a dashboard. My VBA retreives the data a brings it into a new workbook but then when my code attempts to copy and paste in into my forecasting model i receive a runtime error 9 "subscript out of range". I want to declare the...
  13. C

    How to set another workbook as a variable

    I am trying to set an open workbook as variable book2 but keep getting a 'Subscript out of range' error. Below is the code I am working with. It errors at 'Set book2'. It's completely random and will work sometimes but most of the time it doesn't. Could someone help? Set book1 = ActiveWorkbook...
  14. J

    Sub prompts to Open File but get Run Time Error 9 - Subscript out of Range

    Hi Team Amazing, I need some help. I have a sub that allows users to select a workbook and then open it. I then prompt them to select the tab that contains the data required. I then want to copy all of the data from this tab and paste it into the workbook where the Sub is located...
  15. 3

    "Subscript out of range", in VBA function?

    Happy sunday everybody! I am new to vba and I am trying to create a deck of 40 cards (mazzo2), with suits (seme) and values (valore): Function NtoCarta40() As String Dim seme(1 To 40) As String, valore(1 To 40) As Long, i As Long, mazzo2(1 To 40) As String For i = 1 To 40 Select Case i...
  16. E

    Run-time error ”9”:Subscript Out of Range VBA - Excel 2016

    Thank you for your time. I am a real beginner in the VBA and I am asking for your help for the next issue. I have A sheet called "START" in which an ActiveX ComboBox named ”CLIENTI” is inserted, and A sheet called "CLIENT" in which the Range ”B3:B100” contain hyperlink addresses to various...
  17. J

    HPageBreaks.Location Error

    Hello, I have a piece of code designed to place horizontal page breaks so the heading for a group of data isn't by itself at the bottom of a page. However, it throws a run-time error 9 - subscript out of range. This appears to be a known issue, but Microsoft's solution, to select the last cell...
  18. M

    Subscript out of Range Run-time error 9

    Hi, I am getting a script out of range error message. I am trying to look up the text in cell B4 on Sheet “Specs.” My table array is a named range call “ContinueWithTask”. ContinueWithTask is columns A:X on a sheet called “Task Names”. If the vlookup finds the cells is empty, I want it...
  19. M

    VBA - Subscript Out of Range

    Good Afternoon, been racking my brain on this one for awhile and cannot figure it out. I keep getting a subscript out of range on the second line of code listed below. When I run this code on a regular table it works great, but when ran on a pivot table it wont work. Any help would be greatly...
  20. C

    Subscript Error when using Split

    Hey all, I'm working on this code but everytime I run it, I get a subscript error on the .Value lines. I don't know what I'm doing wrong. Private Sub ComboBox2_Change() Range("F3:PO3").Clear Dim SDates() As String Dim CDates As String Dim c As Range Select Case ComboBox2 Case Is =...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back