Skip to content

VBA

Visual Basic for Applications (VBA)

Macro To Export Each Row as Text File (1 Cell Per Row)

For row = 1 assumes no column header
For D:Test this is where the TXT files would go

Sub SaveAsTextFile()
  Dim row As Long, lastRow As Long
  lastRow = Cells(Rows.Count, "A").End(xlUp).row
  For row = 1 To lastRow
      Open "D:\Test\" & "Row" & row & ".txt" For Output As #1
      Print #1, Cells(row, "A").Value
      Close #1
  Next
End Sub

Exporting records from certain CRMs will let you click the field but not show the link itself - this is how you get it
Build the following Macro

Public Function GetURL(c As Range) As String
   On Error Resume Next
   GetURL = c.Hyperlinks(1).Address
End Function
Use the following in an empty cell
=GetURL(A6)