我有两个代码:
1)从列中获取每个值并生成 *.txt 文件,其值名称为https://superuser.com/questions/387192/excel-create-text-file-named-after-a-cell- contains-other-cell-数据
Sub CreateTxt()
'
For Each ce In Range("A1:A" & Cells(Rows.Count, 1).End(xlDown).Row)
Open ce & ".txt" For Output As #1
Write #1, ce.Offset(0, 1) & " " & ce.Offset(0, 2)
Close #1
Next ce
End Sub
2)查找最后一个非空行
Sub LastRowInOneColumn()
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
MsgBox LastRow
End Sub
我的问题——如何将LastRow从2)代码实现为1)代码?感谢帮助!