我需要创建一个Excel宏来将txt文件中的每个字符导入到列中的单个单元格中。例如。如果文字是"测试",那么" t"会去A1," e"到A2,等等在电子表格中。谢谢!
答案 0 :(得分:1)
尝试根据您的需求进行调整:
Sub Macro1()
Dim s As String, i As Long, j As Long
Open "C:\TestFolder\Inputs.txt" For Input As #1 Len = 1
i = 1
j = 1
Do Until EOF(1)
s = Input(1, #1)
Cells(i, j) = s
i = i + 1
If i > Rows.Count Then
i = 1
j = j + 1
End If
Loop
Close #1
End Sub