返回列表 上一主題 發帖

[發問] 如何讓表單自動產生財產編號??

回復 1# afu9240
  1. Private Sub ComboBox3_Change()
  2. With 工作表1
  3. n = Application.CountIf(.[A:A], ComboBox3 & "*")
  4. TextBox1.Text = ComboBox3 & Format(n + 1, "0000")
  5. End With
  6. End Sub

  7. Private Sub CommandButton1_Click() '新增輸入
  8.     Dim x As Integer
  9.     TextBox11.Text = Date
  10.     CommandButton1.Visible = False
  11.     CommandButton9.Visible = True
  12. End Sub

  13. Private Sub CommandButton2_Click() '結束系統
  14.     End
  15. End Sub

  16. Private Sub CommandButton9_Click() '儲存
  17.      Dim CT As Control
  18.    
  19. For Each CT In Controls
  20.    If CT.Parent.Name = "Page1" And CT.Name Like "*Box*" Then
  21.       If CT = "" Then MsgBox "資料未填": Exit Sub
  22.    End If
  23. Next
  24. ar = Array(TextBox1, ComboBox3, ComboBox1, TextBox3, TextBox4, TextBox5, TextBox6, TextBox8, ComboBox2, TextBox9, "", TextBox7, TextBox10, "", TextBox11)
  25. With 工作表1
  26. .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Resize(, UBound(ar) + 1) = ar
  27. End With
  28. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 滴水成河。粒米成蘿,勿輕己靈,勿以善小而不為。
返回列表 上一主題