ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving cell content externally. (https://www.excelbanter.com/excel-programming/291988-saving-cell-content-externally.html)

Paul

Saving cell content externally.
 
Using XL 2000

Cell A1 in my worksheet contains concatenated data.
There will be upto 200 rows.

I'm looking for a code solution that would loop through
each cell in the range (A1:A100), collect and save the
content, line by line in a text file on my local drive.

Each time the macro was executed, The new data would
overwrite the existing file.

If possible, any ideas appreciated.
Many thanks
Paul


Tom Ogilvy

Saving cell content externally.
 
Activesheet.copy
ActiveSheet.Rows(101).Resize(65536-100).EntireRow.Delete
Range("A1:A100").Formula = Range("A1:A100").Value
Columns(2).Resize(,255).Delete
On Error Resume Next
kill "C:\MyData\Myfile.Txt"
On Error goto 0
ActiveWorkbook.SaveAs "C:\MyData\Myfile.txt", FileFormat:=xlText
ActiveWorkbook.Close SaveChanges:=False

--
Regards,
Tom Ogilvy

"Paul" wrote in message
...
Using XL 2000

Cell A1 in my worksheet contains concatenated data.
There will be upto 200 rows.

I'm looking for a code solution that would loop through
each cell in the range (A1:A100), collect and save the
content, line by line in a text file on my local drive.

Each time the macro was executed, The new data would
overwrite the existing file.

If possible, any ideas appreciated.
Many thanks
Paul




Paul

Saving cell content externally.
 
Thank you Tom.
Your solutions, as usual, are perfect!

Paul

-----Original Message-----
Activesheet.copy
ActiveSheet.Rows(101).Resize(65536-100).EntireRow.Delete
Range("A1:A100").Formula = Range("A1:A100").Value
Columns(2).Resize(,255).Delete
On Error Resume Next
kill "C:\MyData\Myfile.Txt"
On Error goto 0
ActiveWorkbook.SaveAs "C:\MyData\Myfile.txt",

FileFormat:=xlText
ActiveWorkbook.Close SaveChanges:=False

--
Regards,
Tom Ogilvy

"Paul" wrote in

message
...
Using XL 2000

Cell A1 in my worksheet contains concatenated data.
There will be upto 200 rows.

I'm looking for a code solution that would loop through
each cell in the range (A1:A100), collect and save the
content, line by line in a text file on my local drive.

Each time the macro was executed, The new data would
overwrite the existing file.

If possible, any ideas appreciated.
Many thanks
Paul



.



All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com