Hi All
Could someone help me import/export the attached excel file to/from text file
I just want the maarks to be exported/imported
Thank you in advance
Ahmedee
Hi All
Could someone help me import/export the attached excel file to/from text file
I just want the maarks to be exported/imported
Thank you in advance
Ahmedee
GUURE
You need to be clearer and tell us exactly what a .txt output file should look like.
Do you literally mean a .txt or perhaps a csv?
I presume, but you don't say, that you want names as well as marks?
Do you want Total Marks?
When you say you want to import a file what does the file you want to import look like. Please upload.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
Thank you Richard for the reply.
What I need is a way I can export non formulated data; names and marks (Not percentage and totals) to a textfile (.txt) and allows me to import it later.
I dont care how the exported data looks like in the textfile.
.
.
Here is a project you can use. Everything is there, you just have to alter the range values to match your existing data orientation.
It includes two different methods of 'reading and writing' a text file.
Thank you for the add rep.
Please mark the thread as solved.
Dear Logit.
I am still unable to apply this in my sheet.
May you please?
Hello,
Anyone would help me to do this?
Try this
![]()
Sub PrintAsString() Dim sLine As String Dim sFName As String Dim intFNumber As Integer Dim lCounter As Long Dim lLastRow As Long Dim i As Long lLastRow = 11 sFName = ThisWorkbook.Path & "\Excel Data (Print).txt" intFNumber = FreeFile Open sFName For Output As #intFNumber For lCounter = 4 To lLastRow With Sheet1 sLine = .Cells(lCounter, 2) & vbTab For i = 3 To 15 sLine = sLine & .Cells(lCounter, i) & vbTab Next i End With Print #intFNumber, sLine Next lCounter Close #intFNumber MsgBox "Values From Sheet '" & Sheet1.Name & "' Were Written To '" & sFName & "' File!", vbInformation End Sub
![]()
Sub ReadStringData() Dim sLine As String Dim sFName As String Dim intFNumber As Integer Dim lRow As Long Dim lColumn As Long Dim vDataValues As Variant Dim intCount As Integer sFName = ThisWorkbook.Path & "\Excel Data (Print).txt" intFNumber = FreeFile On Error Resume Next Open sFName For Input As #intFNumber If Err.Number <> 0 Then MsgBox "Text File Not Found!", vbCritical, "Error!" Exit Sub End If On Error GoTo 0 lRow = 18 Do While Not EOF(intFNumber) Line Input #intFNumber, sLine vDataValues = Split(sLine, vbTab) With Sheet1 lColumn = 2 For intCount = LBound(vDataValues) To UBound(vDataValues) .Cells(lRow, lColumn) = vDataValues(intCount) lColumn = lColumn + 1 Next intCount End With lRow = lRow + 1 Loop Close #intFNumber Range("A1").Select MsgBox "Values From File '" & sFName & "' Were Imported To Sheet '" & Sheet1.Name & "'!", vbInformation End Sub
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
شكرا جزيلا اخى العزيز
طيب الله اوقاتك
It is solved
You're welcome. Glad I can offer some help
Thanks for Logit as he has posted the original code
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks