MS Excel VB to export data to text file

123raajesh

New Member
Joined
Apr 28, 2014
Messages
4
Hi,

I am new vba and like to know if there is a way using excel macros or VB in Windows to:


1) create .txt file name using value or content of a cell say A1. It could be alphanumeric.
2) Then get excel data from range column B, where the rows count varies. Should get only data not empty rows of column B.
3) Save the text file on desktop, show message of exact location of file saved.
4) Now as its saved, if macro is run again with same text file name, should replace the previous file if its name is same.
5) The macro is run from another sheet in same workbook, not from the sheet which contains data. Say Macro is from sheet1 and data is in sheet2, the data contains quotes singe or double and pipe, which should not be affected on export.
6) And the clipboard should be cleared after export, as in this code.
We are using office 2010. Pleas suggest simple and easiest way.

Please suggest.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,226,730
Messages
6,192,698
Members
453,747
Latest member
tylerhyatt04

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