error #9

  1. 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...
  2. L

    Loop runs into subscript out of range in the last row?

    Hi all, So I have this code, works like a charm except it runs into a "run time error 9 subscript out of range" instead of just finishing.. It does the job and then in the last row it pops up the error. Any ideas why? Sub testing2() Dim Dict As Scripting.Dictionary Dim DictKey As String Dim...
  3. A

    Load ComboBox from Range

    Good afternoon all, First time here and requiring some help. I was using this code successfully since the beginning of my coding. Today I added a substantial amount of code to the UserForm and now I receive error message on my initial ComboBox load. Private Sub Worksheet_Activate()...
  4. C

    Error 9: Subscript out of range

    The following is just part of my code. i am getting an Error 9: Subscript out of range. I've tried a few things in order to correct this but nothing seems to change it. r = 2 c = 2 i = 2 LastRowNumber = xlLastRow(Sheets("Data")) Do While...
  5. M

    Excel VBA Copy and Paste Code Error

    Hi I'm trying to write a code that will copy data from one workbook and paste it to another. I'm inexperienced with coding, so I copied a code I found online. I tired to add some lines that would allow the user to choose any workbook to copy from. Once I added these lines I got this error...
  6. Z

    Printing Sheets in Single PDF Error

    Hi all! I have this problem trying to print multiple sheets in a single pdf. Browsing online and in the forum i found this code but when i use it i get the ERROR 9 "Subscript out of range" and i dont understand why. I tried in a new workbook the code and it works properly. Can someone help...
  7. X

    Problem with Macro error 9

    Hey Mr. Excel i have this 2 Subs, and 4 excel sheets Sub copyPasteData() Dim strSourceSheet As String Dim strDestinationSheet As String Dim lastRow As Long strSourceSheet = "Counting" Sheets(strSourceSheet).Visible = True Sheets(strSourceSheet).Select...
  8. D

    Run Time Error '9' - Copying first worksheet from specific excel files

    Hi, I am very new at VBA and have been exploring it to help automate a form I need to compile everyweek. After deleting worksheets indexed 4 and above, the code should reach in the same directory as the activework book and open specific files as outlined by source1, source2, source3, and...
  9. slaim

    VBA COPY sheet's data in an other Workbook

    Hello everyone :) I've a problem with the copy of a data present in a book to another one. "Copy method of Worksheet class failed" error 1004... (which is a "unfound book " error I think) Here you can read my code: debut: 'OPEN THE BOOK: ON ERROR (CANNOT FIND THE BOOK) --> CREATE...
  10. Z

    Copy Sheets of a specific color from multiple workbooks into 1 consolidated file

    Hi, I'm trying to take all the sheets of a specific color (in my code below it's light blue) from a group of workbooks and combine them into one new workbook. This code works for the first file, but then gives me a "subscript out of range" error when trying to copy the tabs from the second...
  11. B

    Little Help With VBA Code Error.

    Sub recipecreator() Dim modName As String Dim modFolder As String Dim modnameFolder As String Dim modrecipeFolder As String Dim modblockFolder As String Dim itemName As String Dim inputOne As String Dim inputTwo As String Dim inputThree As String Dim...
  12. J

    Run-time error '9': SUbscript out of range?

    This error message pops up when I run the macro, "Run-time error '9': Subscript out of range" I was wondering what could be wrong with the code? "Sheets(sheetName).Activate" is highlighted. THANKS!!! Here is my code: Function calAutoNumber(sheetName As String, StartCol As String, startrow As...
  13. A

    Error Handling Question

    Greetings, My situation is this, i want to have different error messages for an error that has the same error number. pls help thanks Sub CopyTemp() Dim WWcellname As String Dim Pcellname As String Dim Tcellname As String Dim Workshets As String Dim Workshets1 As String WWcellname =...
  14. B

    Create worksheet if worksheet does not exist

    Hi, I am new to the forum, but have been using it quite a lot to learn more about VBA. I am trying to write some code that will check a range of names within a worksheet and if there is a sheet with a name from the range excel should ignore it and move on to the next range. If no such worksheet...
  15. B

    VBA: questions about working with arrays

    Greetings, I'm trying to learn how to work with arrays. in this sample that i wrote i keep receiving an error at the "Msgbox MyArray(i)" line. the goal is to have the msgbox cycle through all of the values in the array. the error is "Subscript out of Range" Sub Sample() Dim i As Integer...

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 MrExcel.com.
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 "mrexcel.com".
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
Back
Top