Objective: I want to export a known range of Cells to a .txt file with the click of a command button. I want the file to be automatically saved with the name as the value of a cell (A12)
I already did some research and was able to slightly change an existing code I found that someone created to export the range to a .txt. However the name is not based on the value of Cell A12. I believe this is an easy thing to do, but I know absolutely nothing about Visual Basic.
This is my Existing Code I am using for the Command Button:
Thanks!
I already did some research and was able to slightly change an existing code I found that someone created to export the range to a .txt. However the name is not based on the value of Cell A12. I believe this is an easy thing to do, but I know absolutely nothing about Visual Basic.
This is my Existing Code I am using for the Command Button:
Code:
Private Sub CommandButton1_Click()
Dim c As Range, r As Range
Dim output As String
For Each r In Range("AR8:AR211").Rows
For Each c In r.Cells
output = output & c.Value
Next c
output = output & vbNewLine
Next r
Open "C:\Users\Owner\Documents\RenameToParcel.txt" For Output As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL]
Print [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , output
Close
End Sub
Thanks!