I will be importing 4 text files into a worksheet.
I'm doing this by a command button for each text file, ( the only way I could figure out adding multiple text file to one worksheet, there maybe a better way, but this work). Here is the code for one of the buttons, the other three are the same except for the file path and name.
the text file contians 23 numbers with a separator ( this could be any of these: Colon, Simi Colon, Space, or a Comma). The file now just goes into one cell. I'd like to separate each number into a individual cell, is this possible?
I'm doing this by a command button for each text file, ( the only way I could figure out adding multiple text file to one worksheet, there maybe a better way, but this work). Here is the code for one of the buttons, the other three are the same except for the file path and name.
Code:
Private Sub cmdcyan_Click()
Dim sFile As String
Dim sText As String
Dim iFileNum As Integer
sFile = "C:\Documents and Settings\oneway\Desktop\cyan.txt"
iFileNum = FreeFile
Open sFile For Input As iFileNum
Input #iFileNum, sText
Close #iFileNum
If Cells(1, 1).Value = "" Then
lRowNum = 1
Else
lRowNum = ActiveSheet.UsedRange.Rows.Count + 1
End If
Cells(lRowNum, 1).Value = sText
End Sub
the text file contians 23 numbers with a separator ( this could be any of these: Colon, Simi Colon, Space, or a Comma). The file now just goes into one cell. I'd like to separate each number into a individual cell, is this possible?