#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default vba

hi can anybody tell me how to input data with an input box asking for the
data file and then using the input statement placing the data in the first
four column's of each row until the data has ended this would be a great help
thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default vba

What is the layout of the data file? Four values then a LF, comma delimited, space or tab
delimited, or is it just....? Details needed.

HTH,
Bernie
MS Excel MVP


"ashw1984" wrote in message
...
hi can anybody tell me how to input data with an input box asking for the
data file and then using the input statement placing the data in the first
four column's of each row until the data has ended this would be a great help
thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default vba

the data file looks like this

10, 87, 98, 98
789, 77, 647, 748
7, 87, 87, 56
and so on

"ashw1984" wrote:

hi can anybody tell me how to input data with an input box asking for the
data file and then using the input statement placing the data in the first
four column's of each row until the data has ended this would be a great help
thanks


the
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default vba

Sub ImportDataFile()
Dim myFName As Variant
Dim myWkSht As Worksheet

Set myWkSht = ActiveSheet

ChDir "C:\FolderName with data files"
myFName = Application.GetOpenFilename(, , "Select the Data File")

If myFName = False Then
MsgBox "You pressed Cancel"
Exit Sub
Else
Workbooks.OpenText Filename:=myFName, _
StartRow:=1, DataType:=xlDelimited, Comma:=True
End If

Range("A:D").Copy _
myWkSht.Range("A:D")
ActiveWorkbook.Close False

End Sub

HTH,
Bernie
MS Excel MVP


"ashw1984" wrote in message
...
the data file looks like this

10, 87, 98, 98
789, 77, 647, 748
7, 87, 87, 56
and so on

"ashw1984" wrote:

hi can anybody tell me how to input data with an input box asking for the
data file and then using the input statement placing the data in the first
four column's of each row until the data has ended this would be a great help
thanks


the



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



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