VBA Transpose Excel Cells to a Text document

sab296

New Member
Joined
Oct 17, 2012
Messages
3
:confused:

Good morning friends. I am hoping that one of you can help me. I have an excel spreadsheet that is just two columns (A and B) I would like to have them transposed into a text Document when I click a button (already made and I can assign macro) All I need is a code to do it. So far I've only been able to get the column A to transpose but cannot figure out how to include column B.

Here is what I have:

Sub NotePadByTab()
Dim ws As Worksheet
Dim FF
Dim I As Long

For Each ws In ThisWorkbook.Worksheets
I = I + 1
arr = ws.Range("A1:A20")

arr = Application.WorksheetFunction.Transpose(arr)

arr = Join(arr, vbCrLf)

FF = FreeFile

Open "C:\Users\staff\Desktop\untitled.txt" & I & ".txt" For Output As #FF
Print #FF, arr
Close #FF
Next ws

End Sub

I also have a few questions:

Would this still work with a drop down menu?

Is there a way that wouldn't require the 'untitled' file and it just creates a new file from nowhere?


Mr.excel is a great tool and I thank everyone who contributes.

Best,

Seth Barradas
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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