EXCEL VBA只输出为文本
展开全部
Sub s()
Dim rg As Range
Set rg = [a39:j1308]
arr = rg
pt = ThisWorkbook.Path & "\全数据.txt"
rg.ClearContents
For i = 1 To 10
k = 0
For j = 1 To 1270
If arr(j, i) <> "" Then
k = k + 1
Cells(k + 38, i) = arr(j, i)
End If
Next
Cells(38, i) = i - 1 & "共" & k & "个"
c = c + k
Next
[m38] = "全共" & c & "个"
Open pt For Output As #1
Print #1, Join(Application.Transpose(Application.Transpose([a38:m38])), Chr(9))
For i = 39 To 1308
Print #1, Join(Application.Transpose(Application.Transpose(Cells(i, 1).Resize(1, 10))), Chr(9))
Next
Close #1
End Sub
2015-12-10
展开全部
Sub CommandButton1_Click()
Open "D:\new.txt" For Output As #1
Print #1, Right(Sheets(1).Cells(1, 1).Value, 2)
Close #1
End Sub
Open "D:\new.txt" For Output As #1
Print #1, Right(Sheets(1).Cells(1, 1).Value, 2)
Close #1
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询