Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Overwriting prior formula

I'm trying to setup a code to import a .txt file into Excel. I have the
import code programmed into a button on Sheet 1 that imports the file into
Sheet 2 starting in cell A1, using four columns through D1.

My problem is that when I try to update the .txt file and re-import it, it
moves to E1 through H1, then I1 through L1, etc., and screws up my other
formulas that rely on this information.

How can I set this formula to overwrite the previous information and not
move to the next available space?

Here's a copy of the code:

Sub importlist()
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:="TEXT;P:\c ount\count.txt",
_
Destination:=Range("A1"))
.Name = "count"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(7, 25, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub


TIA....
Mark



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Overwriting prior formula

Try erasing the old information first, right after you select Sheet2.......

Range("A1:D1").ClearContents

hth
Vaya con Dios,
Chuck, CABGx3


"Mark" wrote:

I'm trying to setup a code to import a .txt file into Excel. I have the
import code programmed into a button on Sheet 1 that imports the file into
Sheet 2 starting in cell A1, using four columns through D1.

My problem is that when I try to update the .txt file and re-import it, it
moves to E1 through H1, then I1 through L1, etc., and screws up my other
formulas that rely on this information.

How can I set this formula to overwrite the previous information and not
move to the next available space?

Here's a copy of the code:

Sub importlist()
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:="TEXT;P:\c ount\count.txt",
_
Destination:=Range("A1"))
.Name = "count"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(7, 25, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub


TIA....
Mark




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Overwriting prior formula

TYVM!
I knew it was something simple, but my simple mind couldn't think of it.

Thanks, again!

Mark


"CLR" wrote in message
...
Try erasing the old information first, right after you select

Sheet2.......

Range("A1:D1").ClearContents

hth
Vaya con Dios,
Chuck, CABGx3


"Mark" wrote:

I'm trying to setup a code to import a .txt file into Excel. I have the
import code programmed into a button on Sheet 1 that imports the file

into
Sheet 2 starting in cell A1, using four columns through D1.

My problem is that when I try to update the .txt file and re-import it,

it
moves to E1 through H1, then I1 through L1, etc., and screws up my

other
formulas that rely on this information.

How can I set this formula to overwrite the previous information and not
move to the next available space?

Here's a copy of the code:

Sub importlist()
Sheets("Sheet2").Select
With

ActiveSheet.QueryTables.Add(Connection:="TEXT;P:\c ount\count.txt",
_
Destination:=Range("A1"))
.Name = "count"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(7, 25, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub


TIA....
Mark






  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Overwriting prior formula

You're quite welcome..........I've been automating a bunch of Queries lately
and have become just as frustrated until I fell upon the
answer.........thanks for the feedback.

Vaya con Dios,
Chuck, CABGx3




"Mark" wrote:

TYVM!
I knew it was something simple, but my simple mind couldn't think of it.

Thanks, again!

Mark


"CLR" wrote in message
...
Try erasing the old information first, right after you select

Sheet2.......

Range("A1:D1").ClearContents

hth
Vaya con Dios,
Chuck, CABGx3


"Mark" wrote:

I'm trying to setup a code to import a .txt file into Excel. I have the
import code programmed into a button on Sheet 1 that imports the file

into
Sheet 2 starting in cell A1, using four columns through D1.

My problem is that when I try to update the .txt file and re-import it,

it
moves to E1 through H1, then I1 through L1, etc., and screws up my

other
formulas that rely on this information.

How can I set this formula to overwrite the previous information and not
move to the next available space?

Here's a copy of the code:

Sub importlist()
Sheets("Sheet2").Select
With

ActiveSheet.QueryTables.Add(Connection:="TEXT;P:\c ount\count.txt",
_
Destination:=Range("A1"))
.Name = "count"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(7, 25, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub


TIA....
Mark







Reply
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
Overwriting Duplicates in certain cases marshall New Users to Excel 1 February 22nd 06 08:12 AM
Overwriting data Cody Excel Discussion (Misc queries) 5 November 27th 05 02:40 AM
Copying format to a new cell, w/o overwriting destination cell contents James C Excel Discussion (Misc queries) 1 October 18th 05 08:02 PM
Overwriting error message #NUM! with meaningful text Radio Ham Excel Discussion (Misc queries) 3 September 2nd 05 05:33 PM
Overwriting Cells Keith bedford Excel Discussion (Misc queries) 4 March 9th 05 11:46 PM


All times are GMT +1. The time now is 08:41 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"