返回列表 上一主題 發帖

[發問] 請問如何用VBA寫入不同儲存格

回復 2# spensers

參考看看
不確定是否是你要的
  1. Private Sub B1_Click()
  2.     Cells(4, "A") = myA.Text
  3.     Cells(5, "B") = myB.Text
  4.     Cells(6, "B") = myC.Text
  5.     Cells(8, "B") = myD.Text
  6.     Cells(9, "B") = myE.Text
  7.     Cells(10, "B") = myF.Text
  8.     Cells(9, "F") = myG.Text
  9.     Cells(10, "F") = myH.Text
  10.     If Range("B24") <> "" Then
  11.         MsgBox "已填滿12項"
  12.     Else
  13.         r = Range("B24").End(xlUp).Row + 1
  14.         Cells(r, "B") = myI.Text
  15.         Cells(r, "C") = myJ.Text
  16.         Cells(r, "D") = myK.Text
  17.         Cells(r, "E") = myL.Text
  18.         Cells(r, "G") = myM.Text
  19.     End If
  20. End Sub
複製代碼

TOP

        靜思自在 : 人生沒有所有權,只有生命的使用權。
返回列表 上一主題