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

[µo°Ý] ¨D°ª¤â¸Ñµª¨Ì±ø¥ó¿ë§O¦Û°Ê¿é¤JÀx¦s®æ

¦^´_ 3# GBKEE
¨C¦¸¬Ý¨ì¤j¤jªº¤j§@, ³£¦³«Ü¤jªº¦¬Àò, ÁÂÁÂ!!
¦ý§Ú±N³o½g vba code ¶K¨ì·sªº workbook ªº sheet1 ¤º,
¦A¨ì sheet1 ¾Þ§@, ¦ü¥G¨S¦³¤ÏÀ³, ¨º­Ó¨BÆJº|±¼¤F

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-2-9 07:34 ½s¿è

¦^´_ 1# newlink
³o¤u§@ªí¼Ò²Õ¹w³]ªºÄ²°Êµ{¦¡½X
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     'Change : ¤u§@ªí¸ê®Æ¦³ÅܰʮɩÒIJµoªºµ{§Ç
  4.     Application.EnableEvents = False
  5.     Select Case Target(1).Column
  6.     Case 1
  7.         '·íA2¿ï¾Ü«O¥~or¤H¬°¡AB2¦Û°Ê¶ñ¤W¡¨¶ñª÷ÃB¡¨°µ¬°´£¿ô¡A
  8.         If Target(1) = "«O¥~" Or Target(1) = "¤H¬°" Then Cells(Target(1).Row, "B") = "¶ñª÷ÃB"
  9.         
  10.     Case 2
  11.         '·íB2§ï¶ñ¤W³ø»ùª÷ÃB®É , C2¦Û°Ê¶ñ¤WTODAY¤é´Á
  12.         If IsNumeric(Target(1)) And Target(1) > 0 Then
  13.             Cells(Target(1).Row, "C") = Date
  14.         Else            '¤£¬O¼Æ¦r¥B<0
  15.             Target(1) = "¶ñª÷ÃB"
  16.             Cells(Target(1).Row, "C") = ""
  17.         End If
  18.     End Select
  19.     Application.EnableEvents = True
  20. End Sub

  21. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  22.     'SelectionChange :¤u§@ªíÀx¦s®æ ¦³²¾°Ê®É©ÒIJµoªºµ{§Ç
  23.     If Not Application.Intersect(Range("a:a"), Target) Is Nothing Then  'Àx¦s®æ²¾°Ê¨ìAÄæ®É
  24.         Range("a:a").Validation.Delete
  25.         Target(1).Validation.Add xlValidateList, , , "«O¤º,¤G­×,«O¥~,¤H¬°"
  26.         'Validation ª«¥ó¡A¸Óª«¥ó¥Nªí«ü©w½d³ò¤ºªº¸ê®ÆÅçÃÒ(¿é¤Jªº¸ê®Æ­n²Å¦X«ü©wªº¸ê®Æ)
  27.         'AÄ榳¤U©Ô¿ï³æ¡A¤À§O¬O¡G«O¤º¡B¤G­×¡B«O¥~¡B¤H¬°
  28.     End If
  29. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ iceandy6150 ©ó 2014-2-8 23:11 ½s¿è

¦^´_ 1# newlink

«¢«¢¡A§Ú¬Oµæ³¾¡A¼g¤F¶§¬Kª©ªº
¥i¬O­n«ç»òÅýµ{¦¡¯à¤@ª½°õ¦æ¡A§Ú¤£·|
¦pªG³]¤@­Ó«ö¶s¡A¨C«ö¤@¦¸¡A¥i¥H¨Ï¥Î¤@¦¸¡A¥u°w¹ï²Ä¤G¦C

­n«ç»òÀH®ÉÀHµÛªí®æ¿é¤J´N°¨¤W¸õ°Ê¡A§Ú¤£·|¡AÁÙ­n¦A­×§ï

Sub ex()

Dim i
i = Sheets("¤u§@ªí1").Cells(2, 1).Value
MsgBox (i)

If i = "" Then
Exit Sub

   ElseIf i = "«O¤º" Then

        Sheets("¤u§@ªí1").Cells(2, 2).Value = "--"
        Sheets("¤u§@ªí1").Cells(2, 3).Value = "--"
        Sheets("¤u§@ªí1").Cells(2, 4).Value = "--"
        
   ElseIf i = "¤G­×" Then

        Sheets("¤u§@ªí1").Cells(2, 2).Value = "--"
        Sheets("¤u§@ªí1").Cells(2, 3).Value = "--"
        Sheets("¤u§@ªí1").Cells(2, 4).Value = "--"
   
  
   ElseIf i = "«O¥~" Then

       If Sheets("¤u§@ªí1").Cells(2, 2).Value = "" Then
        Sheets("¤u§@ªí1").Cells(2, 2).Value = "¶ñª÷ÃB"
       End If
        
       If Sheets("¤u§@ªí1").Cells(2, 2).Value <> "" Then
        Sheets("¤u§@ªí1").Cells(2, 3).Value = "=Today()"
       End If
   
Else

       If Sheets("¤u§@ªí1").Cells(2, 2).Value = "" Then
        Sheets("¤u§@ªí1").Cells(2, 2).Value = "¶ñª÷ÃB"
       End If
        
       If Sheets("¤u§@ªí1").Cells(2, 2).Value <> "" Then
        Sheets("¤u§@ªí1").Cells(2, 3).Value = "=Today()"
       End If

End If

End Sub
«¢Åo~¤j®a¦n§r

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD