返回列表 上一主題 發帖

[發問] 輸入某區域,會跳出提示晝面?

[發問] 輸入某區域,會跳出提示晝面?

學妹又來麻煩大家了

打開 EXCEL 檔有詳細說明喔

請帥哥/美女版主 帥哥/美女學長跟學姐

幫忙學妹完成

Book2.rar (4.22 KB)

回復 1# metrostar
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Intersect(Target, [D3:D8]) Is Nothing Or Target.Count <> 1 Then Exit Sub
  3. If Application.Sum([D3:D8]) < 510 Then msg = "數值總和差 " & 510 - Application.Sum([D3:D8])
  4. If Target Mod 1 <> 0 Then msg = "只能輸入整數": fs = True
  5. If Application.Sum([D3:D8]) > 510 Then msg = "數值最大只能輸入 " & 510 - Application.Sum([D3:D8]) + Target: fs = True
  6. If Target < 0 Or Target > 255 Then msg = "數值只能介於0~255": fs = True
  7. If msg <> "" Then MsgBox msg
  8. If fs = True Then Target.Select
  9. End Sub
複製代碼
學海無涯_不恥下問

TOP

太棒了,可以了 (感恩)
多謝這位帥哥超級版主
學妹非常感動呢
您真是太強太強了
感謝您並祝賀您
幸福好運永遠降臨您身上

TOP

        靜思自在 : 改變自己是自救,影響別人是救人。
返回列表 上一主題