返回列表 上一主題 發帖

如何設定儲存格輸入數值只能一位數

本帖最後由 Hsieh 於 2013-1-11 00:08 編輯

回復 1# yeh6712
thisworkbook模組
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2. Application.MoveAfterReturnDirection = xlDown
  3. End Sub

  4. Private Sub Workbook_Open()
  5. Application.MoveAfterReturnDirection = xlToRight
  6. With ActiveSheet
  7. .ScrollArea = "A1:K100"
  8. With .Range("A1:K100").Validation
  9.         .Delete
  10.         .Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, _
  11.         Operator:=xlBetween, Formula1:="1", Formula2:="9"
  12. End With
  13. End With
  14. End Sub
複製代碼
存檔後重新開啟檔案,在當前作用中的工作表即可有此限制功能
限制輸入.rar (14.27 KB)
學海無涯_不恥下問

TOP

        靜思自在 : 口說好話、心想好意、身行好事。
返回列表 上一主題