Text file import and cell query questions

LwarenceD

New Member
Joined
Nov 24, 2005
Messages
29
Hello,

I am currently importing a text file into my worksheet to strip out specific data.

The text file is also being used at the same time by a datalogger.

The trouble I run into is its hit and miss whether I crash the datalogger due to the textfile being opened by Excel, or Excel hangs if the Datalogger has control of the file at the moment Excel tries to open it.

Is there a way to grab a snapshot or copy of the text file in question so both programs can avoid colliding at the text file?




My Second question is this.

After Excel imports the textfile, it looks for a specific text string in a specific column, once its found, it grabs data from OTHER cells based on that cell.

*** Solved this with a nudge from Carl..***
Code:
Dim c As Range
With Worksheets(1).Range("D4:D6")
  Set c = .Find("GPS", LookIn:=xlValues)
  If Not c Is Nothing Then
     Range("I10:K10").Select
     Selection.Copy
     Range("M25:O25").Select
     ActiveSheet.Paste
     Range("A1").Select
  Else
     Range("I8:K8").Select
     Selection.Copy
     Range("M25:O25").Select
     ActiveSheet.Paste
     Range("A1").Select
  End If
End With


So all I have remaining is a to only grab the first 10 lines on the text file, or a way to quickly import the whole file avoiding the datalogger collision.

Any assistance is appreciated.

Cheers
Lwarence[/code]
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
I would try making a separate copy of the file for Excel to work on - either manually or with a macro using FileCopy.

You could also try importing your lines with this, although I guess you would get the same problem :-
http://www.mrexcel.com/board2/viewtopic.php?p=776905#776905

Instead of :-
Do While Seek(FileNum) <= LOF(FileNum) .... Loop
use something like :-
For x = 1 To 10 ....... Next
 

Watch MrExcel Video

Forum statistics

Threads
1,118,799
Messages
5,574,379
Members
412,589
Latest member
ArtBOM
Top