LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB Problem - Help!


Hi all,

I'm trying to run the below macro that imports a text (.txt) file int
a spreadsheet. However, when I run the macro I get a Runtime erro
message. The debugger points to the line highlighted red below.

Can anyone suggest what's wrong here?

TIA,

SamuelT


Sub Import_Control_Sheet()
'
' Import_Control_Sheet Macro
' Macro recorded 06/09/2005 by PalletV
'

'
Range("A8").Select
ActiveCell.Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;U:\Card_Processing\PAD\Reconcilliation\Pendi ng", _
Destination:=Range("A8"))
.Name = "From_Notes_8"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 2, 2, 2, 2, 2, 1
2, 2)
.Refresh BackgroundQuery:=False
End With
Columns("G:G").Select
Selection.NumberFormat = "0.00"
Columns("P:P").Select
Selection.NumberFormat = "0.00"
Range("P8").Select
ActiveCell.FormulaR1C1 = "=RC[-6]/100"
Range("P8").Select
Selection.Copy
ActiveCell.Offset(0, -6).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 6).Range("A1").Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(0, -6).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 8).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=IF(RC[-17]=14,1,"" "")"
ActiveCell.Select
Selection.Copy
ActiveCell.Offset(0, -2).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
ActiveCell.Offset(-7, -8).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.Offset(2, 0).Range("A1").Select
Columns("P:P").Select
Selection.EntireColumn.Hidden = True
Columns("P:P").Select
Selection.ClearContents
Columns("C:L").EntireColumn.Select
Selection.Columns.AutoFit
ActiveCell.Offset(0, -2).Range("A1").Select
ChDir "V:\Card_Processing\PAD\Reconcilliation\Done"
ActiveWorkbook.SaveAs Filename:= _

"V:\Card_Processing\PAD\Reconcilliation\Done\Contr ol_Template.xls"
FileFormat _
:=xlNormal, Password:="", WriteResPassword:=""
ReadOnlyRecommended:= _
False, CreateBackup:=False
End Su

--
Samuel
-----------------------------------------------------------------------
SamuelT's Profile: http://www.excelforum.com/member.php...fo&userid=2750
View this thread: http://www.excelforum.com/showthread.php?threadid=52302

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"