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表
兩個辦法,簡單的,這麼寫:
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下,能看懂,有問題可以問。看不懂我覺得你干脆放棄。我也懶得多說,