Hi all
Still having problems trying to activate a worksheet
Most likely it is the active worksheet, I just need to make sure it is at
run-time
Bugs out here:
In the GetData procedure
Error msg : Subscript out of range
I also tried
Worksheet("Sheet1").Activate and
Sheets("Sheet1").Activate
The actual name of the sheet will always be "strip_pdf_text" w/o quotes
as defined by a .vbs process to convert from .pdf to .txt and then to .tsv.
The file contains only 1 sheet
Here is the entire code:
Thanks
-marc
Code
Sub AR_Analyze()
Application.ScreenUpdating = False
Call Clear_Old
Call OpenSelectedFile
Call Save_Active
Call GetData
Application.ScreenUpdating = True
End Sub
Sub Clear_Old()
Workbooks("AR_Analyze.xls").Worksheets("SDX_AR").Range("A10:F65536").Clear
End Sub
Sub OpenSelectedFile()
Dim myFile As Variant
myFile = Application.GetOpenFilename("E*xcel Files (*.xl*), *.xl*", _
, "Pick one:")
If myFile <> False Then Workbooks.Open (myFile)
End Sub
Sub Save_Active()
ChDir "C:\AR"
With ActiveWorkbook
.SaveAs Filename:="C:\AR\myWorkingFile.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End With
End Sub
Sub GetData()
Application.DisplayAlerts = False
Dim lngRows As Long
Workbooks("myWorkingFile.xls").Activate
Worksheets("Sheet1").Activate
lngRows = Range("A65536").End(xlUp).Row
Worksheets("Sheet1").Range("A2:F" & lngRows).Copy
ActiveWorkbook.Close SaveChanges:=False
Workbooks("AR_ANALYZE.xls").Activate
Sheets("SDX_AR").Select
Range("A10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Application.DisplayAlerts = True
End Sub
Display More