Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can either import the entire file and clear the unneeded data or use
VB's file i/o commands in a macro like this: Sub FileImport() Dim ResultStr As String Dim FileName As String Dim FileNum As Integer Dim Counter As Double FileName = InputBox("Name of text file to import:") If FileName < "" Then FileNum = FreeFile() Open FileName For Input As #FileNum While Not EOF(FileNum) And Counter < 5 Counter = Counter + 1 Line Input #FileNum, ResultStr Cells(Counter, 1).Value = ResultStr Wend Close End If End Sub -- Jim Rech Excel MVP "Jacob" wrote in message ... | Hi! | | I am making a macro that imports data and makes a list of the one I need. | | I only need data in the first 5 lines. since it is a rather long file I | would like to only import the first lines. In the import dialog there is an | option that allows for a starting line. | | How do I stop importing after 5 lines. | | Jacob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
import XML data...Is there a size limit on the import? | Excel Discussion (Misc queries) | |||
How to Start Excel in Text Import Wizard for data import | Setting up and Configuration of Excel | |||
Import external data, data includes Excel function | Excel Worksheet Functions | |||
Tool bar: Data/Import external data/New database query | Setting up and Configuration of Excel | |||
Prevent equation from skipping data when referencing import data? | Excel Discussion (Misc queries) |