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

[µo°Ý] Msgbox¥i¤£¥i¥HŪ¨úexcel ®æ¤º¨ç¼Æ

[µo°Ý] Msgbox¥i¤£¥i¥HŪ¨úexcel ®æ¤º¨ç¼Æ

Msgbox ¥i¤£¥i¥HÀq»{¿é¤J¤º®e¡C°²¦p§Ú¿é¤JPB00891¡A¥i¤£¥i¥HÀq»{PB¦r¥À¡AµM«á·|¼u¥X´£¥Ü¿ù»~¡C
A2:A481¡A±½´yºj¿é¤J¤º®e¡A¦³¨â²Õ¦r¥À¥[¼Æ¦rPA001¡APB456¡A§Ú³]©wVLOOKUP¨úPA¦æÀYŪ¨úPB¡C
·í¿é¤J¨tPB456¡AB2®æ·|Åã¥Ü#N/A¡C§Ú´N·Q¨t³o­Ó®É­Ô§Q¥ÎMsgbox ´£¥Ü¿é¤J¤º®e¬OPB¦æÀY¡C
½Ð°Ý«e½ú¥i¤£¥i¥H±Ð§Ú¡C

  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Column = 1 And Target.Count = 1 Then
  3.   If Target.Row Mod 2 = 0 Then
  4.     If Left(Target.Value, 2) = "PB" Then MsgBox "§A­nÅã¥Üªº¤º®e", , "¿ù»~´£¥Ü"
  5.   End If
  6. End If
  7. End Sub
½Æ»s¥N½X
¦^´_ 1# coke373

TOP

¦^´_ 2# ¸­°ê¬w


    ¸­¤j­ô ÁÂÁ§A¡Amsgbox¥i¥H¹B¦æ¡C
§A¥i¤£¥i¥H¬°§Ú¸Ñ»¡¤@¤U¡A¨º¤@¥y¬O§Î®eA2¿é¤JPB¬O¿ù»~¡A¦P®É¥i¥H¹j¦æŪ¨ú¡C
§Ú·Qª¾¹D¤¤¤å·N«ä¡C½Ð§A±Ð§Ú¡C

TOP

°ÝÃD¬O³o¼Ëªº¡A§Ú¦b¼g¤@­Ó¥i¥HÅý¨Ï¥ÎªÌ¥i¥H§Q¥ÎŪ½X¾÷Ū¨ú±ø½X¿é¤J¸ê®Æªºªí³æ
·í¸Ó±ø½X¦b¨t²Î¤º¥¼«ØÀɮɡA·|§Q¥ÎMSGBOXªº°T®§µøµ¡§@´£¥Ü
¤£¹L¨t²Î­n¨D¥²¶·¥iÅý¨Ï¥ÎªÌ³sÄò¿é¤J¡A¦ÓŪ½X¾÷ªº³]©w­­¨î¬°¿é¤J§¹±ø½X«á­n°eENTERÁä
©Ò¥H·íMSGBOX¥X²{®É¡A¨Ï¥ÎªÌ¦pªG¨S¦³ª`·N¨ì°T®§µøµ¡¡A°¨¤W¤S¨Ï¥ÎŪ½X¾÷Ū¨ú±ø½X®É
¥Ñ©óŪ½X¾÷·|°eENTERÁ䪺Ãö«Y¡A°T®§µøµ¡´N³Qµø¦P«ö¤U¤FENTERÁä¦ÓÃö±¼¤F

½Ð°Ý¬O§_¥i¥H¦b°T®§µøµ¡¥X²{®É¡AÂê©wENTERÁ䤣¯à«ö¡A¥u¯à¥Î·Æ¹«¥h«ö½T©w¡C

¥»¨Ó¬O·Q§ä¬Ý¬Ý¦³¨S¦³µL«ö¶sªº°T®§µøµ¡¡A¤£¹LMSGBOX¨Ã¨S¦³³oºØÃþ«¬......

TOP

msgbox¦³DefaultButton¥i¥Î¡A¤@¯ë·|³]¦b²Ä¤@­Ó¤W(¤ñ¦pyes/no·|¸¨¦byes¤W)¡A§A¥i¥H§â¥¦§ï¬°¥t¤@­Ó¡AµM«á¨Ì·Ó¦^¶Ç­È¥h§PÂ_!

TOP

  1. [code]Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Column = 1 And Target.Count = 1 Then
  3.   If Target.Row Mod 2 = 0 Then
  4.     Dim r
  5. rrr:
  6.     If Left(Target.Value, 2) = "PB" Then r=MsgBox "Input data is error!", 4 or 256, "Error"
  7.     If r <>vbYes Then GoTo rrr
  8.   End If
  9. End If
  10. End Sub
½Æ»s¥N½X
[/code]

TOP

½Ð¤j¤j­ÌÀ°§Ú¬Ý¤@¤U¬O¤£¬O¨º¸Ì¦³°ÝÃD.
§Ú¹B¦æ®É¡AExcel¤@ª½¥d¦í¡C

TOP

  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Column = 1 And Target.Count = 1 Then
  3.   If Target.Row Mod 2 = 0 Then
  4.     Dim MyString
  5.     If Left(Target.Value, 2) = "PB" Then MsgBox "Input data is error!", 4 or 256, "Error"
  6.     If Response = vbYes Then
  7.     MyString = "Yes"
  8. Else
  9.    MyString = "No"
  10.   End If
  11. End If
  12. End Sub
½Æ»s¥N½X

TOP

½Ð¤j¤j­ÌÀ°§Ú¬Ý¤@¤U¡A³o¼Ë¤l¦³°ÝÃD¶Ü?
msgbox¦³DefaultButton¥i¥Î¡A¤@¯ë·|³]¦b²Ä¤@­Ó¤W(¤ñ¦pyes/no·|¸¨¦byes¤W)¡A§Ú·Q§â¥¦§ï¬°¥t¤@­Ó¡AµM«á¨Ì·Ó¦^¶Ç­È¥h§PÂ_!

TOP

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2020-5-6 12:51 ½s¿è

¦^´_ 9# coke373

À³¸Ó¨S¦³¥Î~~
«öENTER©ÎESC«á, MSGBOX·|®ø¥¢, ¤´µM¥i¥HŪ¨ú±ø½X???

¥i§Q¥ÎUSERFORM+LABLE(Åã¥Ü¤å¦r), ±j¨î¥Î·Æ¹«Ãö³¬ªí³æ~~
X001.rar (8.87 KB)

TOP

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