How to export only non-empty cells within a specific range to notepad file?

iMAN2

New Member
Joined
May 19, 2009
Messages
2
Is it possible to attach files?

Hi,
I need to export specific cells from a row in a specific format into a notepad file and then save it as nameoffile.uai

Each row is a different entry in the notepad file.

All details are attached, with a further explanation.

The format.uai file gives an example of the format in which the export is to be made in.

Im very unfamiliar with VB so all i can really do is copy and paste code.

Any help at all would be appreciated.

Thankyou!!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi & welcome,

Unfortunately you can't attach files to the board.

This might give you an idea of how you can achieve what you want:

Code:
Sub Create_File()
 
Dim objFSO As Object
Dim objOutputFile As Object
Dim myRange As Range
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFile = objFSO.CreateTextFile(ThisWorkbook.Path & "\nameoffile.uai")
 
For Each myRange In Sheets("Sheet1").Range("A1:A10")
 
    If myRange.Value <> "" Then
 
        objOutputFile.writeline myRange.Value
 
    End If
 
Next myRange
 
End Sub

It runs down the range A1:A10 on Sheet1 and writes the non-blank entries to a text file called nameoffile.uai in the same folder as the workbook is saved.

If you can provide more info as to the file structure can maybe help you adapt it.

Hope it helps,

Dom
 
Upvote 0
Update from PM's received:

iMAN2 said:
Hi,
I've uploaded my attachment at this site, with a full explaination. I'll look at your replies from this site however.
http://forums.techguy.org/business-applications/828346-excel-how-export-only-non.html#post6704586

ty

Domski said:
iMAN2 said:
Hi,
If possible, can i have your email address. That way i can attach the exact format and everything i need.

Sorry, I don't give out my e-mail.

Do your best to describe what you are trying to achieve on the thread you started before.

Dom

Domski said:
OK, I'll have a look if I get a chance.

In the meantim please read the guidelines for posting: http://www.mrexcel.com/forum/showthread.php?t=127080

I'm not having a go it's just you're far more likely to get a response to your answer if you stick to the board.

Dom
 
Upvote 0
Hi,

Starting from row 4:
I need the code to copy down the first name,
then starting from column g to cd in that row, it should copy down the mark for a subject (if there is a mark under that subject heading), otherwise skip that that subject.
also copy down that subject's, subject code, which is in the second worksheet.

In summary, If mark under subject for that person, look at subject, compare against code list, copy subject's code, then copy the mark.

Copy down any comment for that person.
Further details in the attached file.

Maybe a loop function or something?


Im very unfamiliar with VB so all i can really do is copy and paste code.

Any help at all would be appreciated.

Thankyou!!
smile.gif


UPDATED

NOTE: I have also cross-posted in another forum, so any updates should also be checked there
(ty to 'Dom' for the advice)::

http://www.excelforum.com/excel-prog...epad-file.html

http://www.mrexcel.com/forum/showthr...76#post1942476
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top