返回列表 上一主題 發帖

依對話框要求寫入資料

回復 1# myleoyes
是這樣嗎
   
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.       If Target(1).Address = "$L$2" Then Ex
  3. End Sub
  4. Private Sub Ex()
  5.     Dim Rng(1 To 2) As Range, A
  6.     Set Rng(1) = Cells(Rows.Count, "A").End(xlUp)
  7.     Set Rng(2) = Cells(Rows.Count, "L")
  8.     Do While Rng(1).Row <> Rng(2).End(xlUp).Row
  9.         A = Application.InputBox("輪入第" & Rng(2).End(xlUp).Row - 1 & "個數字", Type:=1)
  10.         If A = False Then Exit Do
  11.         Rng(2).End(xlUp).Offset(1) = A
  12.     Loop

  13. End Sub
複製代碼

TOP

回復 10# luhpro
"Range(Cells(iRows + 1, 12), Cells(65536, 12)) = """
65536這數值是2003版 的最大列數
只是建議用 Rows.Count 取代65536 可適用於任一版本

TOP

        靜思自在 : 並非有錢魷是快樂,問心無愧心最安。
返回列表 上一主題