ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Workbook_SheetChange ºÃ°Ý

¦^´_ 7# swatt
  1. Option Explicit
  2. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
  3. Dim Rng As Range
  4.     Set Rng = Range("H2:I2")
  5.     If Not Intersect(Target, Rng) Is Nothing Then
  6.     '*******************************************************************
  7.     'Intersect ¤èªk   ¶Ç¦^ Range ª«¥ó¡A¦¹ª«¥ó¥Nªí¨â­Ó©Î¦h­Ó½d³ò­«Å|ªº¯x§Î½d³ò
  8.     '*******************************************************************
  9.     'If Target = [h2] Or Target = [i2] Then
  10.         If (Not IsNumeric(Target.Value)) Or IsEmpty(Target.Value) Then
  11.             MsgBox "Must be numeric value!"
  12.             Application.EnableEvents = False
  13.             Target.Value = ""  'this will trigger Target again
  14.             [j2].Value = ""    'clear the cell of yield
  15.             Application.EnableEvents = True
  16.         'Exit Sub
  17.         End If
  18.     End If
  19. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : §g¤l¦p¤ô¡AÀH¤è´N¶ê¡AµL³B¤£¦Û¦b¡C
ªð¦^¦Cªí ¤W¤@¥DÃD