LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro freezes spreadsheet

I have a macro that does the following, it deletes all the data within the
spreadsheet, imports 2 files and then saves the spreasheet. This macro works
fine but when filters have been used within the spreadsheet and i come to run
the macro the spreadsheet freezes on me everytime. Even if i clear all the
filters the error still appears. To work around it i have to remove the
filters, exit and save the spreasheet and then re-open it. The Macro then
works ok again. Any ideas on why this happens ?

The macro i use is below.

The code is below, Thanks

Sub Qualityimport()
'
' Qualityimport Macro
' Macro recorded 24/07/2006 by COATESD
'

'
Application.Goto Reference:="R2C1"
With Selection.QueryTable
.Connection = "TEXT;K:\Mfgpro\datefile.txt"
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1)
.TextFileFixedColumnWidths = Array(8, 10)
.Refresh BackgroundQuery:=False
End With
Application.Goto Reference:="R4C1"
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
Application.Goto Reference:="R4C1"
With Selection.QueryTable
.Connection = "TEXT;K:\Mfgpro\qextract.prn"
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1)
.Refresh BackgroundQuery:=False
End With
Range("A4,C:C").Select
Range("C1").Activate
ActiveWindow.SmallScroll ToRight:=2
Range("A4,C:C,G:G,I:I,J:J").Select
Range("J1").Activate
Columns("G:G").EntireColumn.AutoFit
Columns("I:I").ColumnWidth = 10.57
Columns("J:J").ColumnWidth = 7
Columns("C:C").ColumnWidth = 10.14
Columns("C:C").EntireColumn.AutoFit
Range("H1").Select
ActiveWorkbook.Save
Range("C1").Select
End Sub

Thanks
 
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
Writing a macro that will exit a spreadsheet Dave Doc New Users to Excel 2 January 26th 06 01:41 PM
format macro Jonathan Cooper Excel Discussion (Misc queries) 5 January 9th 06 08:49 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Spreadsheet print including macro buttons? gunga Excel Discussion (Misc queries) 4 February 10th 05 06:30 PM
Sample spreadsheet of using macro Isaac Excel Worksheet Functions 2 November 19th 04 02:22 AM


All times are GMT +1. The time now is 11:13 PM.

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

About Us

"It's about Microsoft Excel"