subscript

  1. The_Kurgan

    Open/manipulate a workbook using BeforeClose event

    I'm attempting to use the BeforeClose event to open another workbook, gather data, and then place it into the original workbook. However, once the workbook is open, the code fails to manipulate it. The ribbon and tabs don't seem to be visible and when the code tries to activate the new...
  2. G

    Subscript out of range error

    I'm trying to copy data in Cell F33 on one workbook to cell B5 on another workbook. Whenever I run the code, I get "subscript out of range" and the debugger highlights the 6th line, containing the copy range. Sub Copy() Dim x As Workbook Dim y As Workbook Set x = Workbooks.Open("Report")...
  3. M

    Closing a Text File

    Hi We have a system that creates a file with a non-standard extension - filename.0000. So the filename might be NRExport.4567. The next file to be exported would be NRExport.4568 and so on. I open this file as a comma delimited file and perform some cleansing on the file using code. I then...
  4. O

    Subscript out of range error?

    Hi, I'm getting the "subscript out of range" error and I'm not sure what's causing it. When I debug it, it stops at the following point: ActiveSheet.ListObjects("Table__2020_RevTM.accdb").Range.AutoFilter Field:=1 This is the whole function, it basically gives me this error when I save...
  5. D

    What is wrong

    Application.Worksheets("Sheet5").DisplayFullScreen = True keep getting subscript out of range error plz help
  6. B

    Subscript out of range (for some users)

    What is the most likely cause for this bit of code to work for one user but not another? It throws a subscript out of range error at the highlighted line when users other than me run it. This issue has vexed me for over 2 weeks now so any assistance is greatly appreciated, in advance. I will...
  7. C

    Subscript Out of Range

    I am not sure what Im missing in this code but Im stumped. I need to take column values from one sheet and place them in different columns in another sheet. I have both files open and the sheet names are set as "Sheet1" but I keep getting a SubScript out of Range error. Any help or suggestions...
  8. A

    Subscript out of range error copying worksheet to new workbook

    I need some help ... Fpath = "U:\PWS\Parks\Parks Operations\Sports\WATSOP19\STAFF\BackupData\" fname = "staff_schedule_BU (" & Format(Now, "dd-mm-yy hh,mm,ss") & ").xlsm" Set newbook = Workbooks.Add wb_pstaff.Worksheets("STAFF_SCHEDULE").Copy after:=newbook.Worksheets("Sheet1") If Dir(Fpath &...
  9. L

    deleting sheets in vba - subscript out of range msg

    Hi I want to delete all the sheets in a workbook except the first one. I wrote the code below but what is the problem, It deleted some but then I got message "subscript out of range". I think because I do not have 40 sheets (my For loop is from 2 to 40). I do not know how many sheets in the...
  10. C

    Subscript out of range error on this code...

    I keep getting "Subscript out of range" run time error code 9 on this code where indicated Sub copyNonBlankData() Dim erow As Long, lastrow As Long, i As Long lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To lastrow If Sheet1.Cells(i, 1) <> “” Then...
  11. P

    run time error 9 subscript out of range

    Hi, i get a run time error 9 subscript out of range and when i debug it highlights in yellow my Uerform7.show can you help at all please to stop this, it happens when i copy data from another spreadsheet into my userform on the main one
  12. C

    Subscript out of range

    I have the following code in vba under the excel object this workbook. When it runs a get error message of subscript out of range. I have verified the worksheet name. Private Sub Workbook_Open() Worksheets(“Startup”).Activate End Sub
  13. R

    Run-Time error '9': Subscript out of range

    I transferred my user-forms and modules to an updated workbook that I was working on and now I get the following error message when I click on my command buttons: Run-time error '9': Subscript out of range When I debug it points to the module for the corresponding command button. One of my...
  14. E

    My hyperlink works when I click the cell but it does not work with the macro

    Range("M6").Select<o:p></o:p> Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True<o:p></o:p> Run time error 9: subscript out of range<o:p></o:p> In other similar macros, the codeworks perfectly<o:p></o:p> <o:p></o:p> Thanks much for any suggestion<o:p></o:p> Leon Traubkatz<o:p></o:p>
  15. S

    VBA SPLIT Error

    Ok, an hour of searching and bending my mind isn't doing the trick, so I turn to you MrExcel experts. I am doing a what-should-be-simple SPLIT on a filename, code below. I get the following error "Subscript out of range", which I believe is because there is nothing in the (1) position in the...
  16. H

    Subscript out of Range when Populating Combobox from One Dimensional Array

    Hello, I have a Combobox on a Userform that I want to populate with a Dynamic One Dimensional Array that currently has 26 elements. But the .List method gives me a Subscript Out of Range error. My code: cbVragVerwysing.List = NewArr(tempCntr) Can someone please give me advice or help on how...
  17. G

    Subscript Out of Range Error

    Was hoping you could help this VB beginner. Keep getting '9' Subscript Out of Range error. Debug brings me to this: lastrow = Sheets("DB").Range("A356000").End(xlUp).Row + 1 The Range is dynamic and I am think my line code is off since I am trying to set some sort of range. Help please...
  18. 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...
  19. T

    Subscript out of range error

    What is wrong with the following? I get a Run-time error '9', subscript out of range error. Workbooks.Open "C:\Files\MyWorkbook.xlsx" Dim a As Long a = Workbooks("C:\Files\MyWorkbook.xlsx").Worksheets.Count Thanks
  20. M

    Activating workbook code not working

    Hi I'm trying to activate a macro enabled file called "Test" that I saved to my desktop. However, I get a "Run time error: 9 Subscript out of range" - the file is open, so just needs to be activated. Please can you help? Workbooks("\Test file.xlsm").ActivateWorkbooks("\Test...

Some videos you may like

This Week's Hot Topics

Top