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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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