![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Location: Jason in Boston MA
Posts: 12
|
I keep getting a "subscript out of range error" in the following piece of code. It was working fine and then suddenly started crashing. I don't see anything wrong.
Sub opentextfile() ' this routine opens a file in text format identified with the variable FILENAME! Workbooks.OpenText FileName:=(guess & UserForm4.ListBox1), Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _ Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _ Array(2, 1)) 'copy file into rawdata sheet Range("A1:I274").Copy Destination:=Workbooks("project.xls").Sheets("RAW_DATA").Range("A1").End(xlUp) ActiveWindow.Close ([True]) ' Copy area counts column and paste it into correct instrument and level transpose it to a row sheetselect = ("gc3_RF") 'this is added here for trouble shooting only remove when fixed Workbooks("project.XLS").Activate Sheets("RAW_DATA").Range("f4:f18").Copy Sheets(sheetselect).Activate 'error occurs here Cells(numit + 3, 2).Select Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _ , Transpose:=True Application.CutCopyMode = False ActiveWorkbook.Save End Sub |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
MS Technet has a few articles that could apply...but this seems most likely.
http://support.microsoft.com/search/...;en-us;Q213395
__________________
~Anne Troy |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Location: Jason in Boston MA
Posts: 12
|
thanks, that seemed to work I still don't know why this suddenly became an issue have been usingthis code for a while.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|