Sub test()
Dim A, p, i
A = Range("a1").CurrentRegion
p = ThisWorkbook.path & "\"
For i = 1 To UBound(A)
If A(i, 2) <> 0 Then Call writeTxt4(p, A(i, 1) & ".txt", A(i, 2))
Next i
End Sub
Sub writeTxt4(p, f, str)
With CreateObject("Scripting.FileSystemObject").CreateTextFile(p & f, True, -1)
.Write str
.Close
End With
End Sub