ohada19950721
2016-01-27 12:03
采纳率: 100%
浏览 2.1k
已采纳

vb 把数据输入到excel表中

For m = 68 To 80 Step 3
For n = 12.6 To 16.2 Step 1.2
For o = 3.6 To 4.4 Step 0.2
For p = 210 To 275 Step 30
If m <> n And m <> o And m <> p And n <> o And n <> p Then
Print m; n; o; p
End If
Next
Next
Next
Next
怎么把print给换成是输入到excel表

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • threenewbee 2016-01-27 13:07
    已采纳

    两个办法,简单的,这么写:
    open "x:\path\1.csv" for output as #1
    For m = 68 To 80 Step 3
    For n = 12.6 To 16.2 Step 1.2
    For o = 3.6 To 4.4 Step 0.2
    For p = 210 To 275 Step 30
    If m <> n And m <> o And m <> p And n <> o And n <> p Then
    Print #1 m &","& n & "," o & "," p
    End If
    Next
    Next
    Next
    Next
    close #1
    虽然这个办法产生的不是真正的excel文件,但是csv文件也可以双击直接在excel打开。

    另一个办法是引用Excel的COM组件,用VBA去操作。难度略大,你google下,能看懂,有问题可以问。看不懂我觉得你干脆放弃。我也懒得多说,

    已采纳该答案
    打赏 评论
  • 把分全给哥 2016-01-27 12:13
    打赏 评论

相关推荐 更多相似问题