Excel单元格内容批量导出为记事本文件

  • A+
所属分类:系统Office
Sub bod()
Dim nm$
For I = 1 To 100 '行数范围
    n = n + 1
    nm = ThisWorkbook.Path & "\" & Application.Trim(Cells(I, 1)) & ".txt"  '记事本文件导出到Excel所在目录,A列为文件名
    Open nm For Output As #I
    Print #I, Cells(I, 1) 'Cells(i, 1)为每个txt里面要放的内容,可替换,内容为空则删除,如果为B列则Cells(i, 2),C列则Cells(i, 3),以此类推
    Close #I
Next
End Sub
weinxin
独角兽驿站
公众号

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: