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

select case ªº¥Îªk

select case ªº¥Îªk

½Ð°Ý¨Ï¥Îselect case  «á­Y¬°¦r¦ê¡A¬O§_¥i¥H§ì"§t¦³"¯S©w¦r¦ê¡H
Select Case Sheets(1).Cells(i, 3).Value
           Case "aa"
           '''''''''''''''''''''''''''''''''''''

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-7-29 15:28 ½s¿è

¦^´_ 1# eric093
  1. Dim s as String
  2. s = Sheets(1).Cells(i, 3).Value
  3. Select Case True
  4. Case s Like "*aa*"
  5.     msgbox "¦r¦ê¥]§taa"
  6. Case Else
  7.     msgbox "¦r¦ê¤£¥]§taa"
  8. End Select
½Æ»s¥N½X

TOP

ÁÂÁÂ-stillfish00 ¡Aok¤F¡I
¤£¹L¡A¥i¥H¦A°l¥[¤@­Ó°ÝÃD¶Ü¡H
«ç»ò§â²Ä¤G­Ó°j°é»P²Ä¤@­Ó¤@°_¼g¶i¥h¡A§Ú·d¦n¤[¤F
Dim  aa As String
Dim row1, row2, row3, i, o, k, j As Integer

row1 = Sheets("1").Range("a65536").End(xlUp).Row
row2 = Sheets("2").Range("a65536").End(xlUp).Row
For i = 2 To row2
aa = Sheets("2").Cells(i, 3).Value
Select Case True
       Case aa Like "*¦¨¥æ*"
                  Sheets("3").Select
                  row3 = Range("a65536").End(xlUp).Row
                  k = row3 + 1
                  Sheets("3").Cells(k, 1).Value = Sheets("2").Cells(i, 3)
                  Sheets("3").Cells(k, 2).Value = Sheets("2").Cells(i, 11)
                  Sheets("3").Cells(k, 3).Value = Sheets("2").Cells(i, 10)
                  Sheets("3").Cells(k, 4).Value = Sheets("2").Cells(i, 25)
                  
End Select
Next

----------------------------------------------------------
row1 = Sheets("1").Range("a65536").End(xlUp).Row
row2 = Sheets("2").Range("a65536").End(xlUp).Row
For j = 2 To row2
For i = 2 To row1
   If Sheets("3").Cells(j, 4) = Sheets("1").Cells(i, 2) _
        And Sheets("3").Cells(j, 2) = Sheets("1").Cells(i, 25) Then
        Sheets("3").Cells(j, 5).Value = Sheets("1").Cells(i, 5)
     Exit For
    End If
Next
Next

TOP

¦^´_ 3# eric093
²Ä¤G¬qªº i ©M j ­n¤¬´«¤~¯à¥[¶i¥h¡C

TOP

ÁÂÁÂ-stillfish00 ¡Aok¤F¡I
¤£¹L¡A¥i¥H¦A°l¥[¤@­Ó°ÝÃD¶Ü¡H
«ç»ò§â²Ä¤G­Ó°j°é»P²Ä¤@­Ó¤@°_¼g¶i¥h¡A§Ú·d¦n ...
eric093 µoªí©ó 2013-7-29 16:55

¦pªG Case ¥u·|¿ï¾Ü¨ì¤@­Ó±ø¥ó, «Øijª½±µ¥Î if ¨Ó¹ê²{:
Select Case True
       Case aa Like "*¦¨¥æ*"
...                  
End Select
¥i§ï¦¨
If aa Like "*¦¨¥æ*" Then
...
Edn If
¤@¤è­±µ{¦¡¬Ý°_¨Ó¸û²¼ä,
¤@¤è­±­Y°õ¦æ¦¸¼Æ«D±`¦h®É¤]¥i¸`¬Ù¨Ç°õ¦æ®É¶¡.

TOP

¤F¸Ñ¡A¨º»òCase aa Like "*¦¨¥æ*"¥i¥H¦³2­Ó±ø¥ó¥H¤W¶Ü¡H
Case aa Like "*¦¨¥æ*" or "*¥¼¦¨¥æ*"¡A¹³³o¼Ë¶Ü

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2013-7-30 00:55 ½s¿è
¤F¸Ñ¡A¨º»òCase aa Like "*¦¨¥æ*"¥i¥H¦³2­Ó±ø¥ó¥H¤W¶Ü¡H
Case aa Like "*¦¨¥æ*" or "*¥¼¦¨¥æ*"¡A¹³³o¼Ë¶Ü
eric093 µoªí©ó 2013-7-29 23:40

§AÀ³¸Ó­n¥Î Case aa Like "*¦¨¥æ*" Or aa Like "*¥¼¦¨¥æ*" (¦b Or ªº¥ª¥kÃä³£À³¸Ó­n©ñ§¹¾ãªº±ø¥ó¦¡)
¨ä¹ê aa Like "*¦¨¥æ*" ´N¤w¸g¦³¥]§t aa Like "*¥¼¦¨¥æ*" ¤F. (¦]¬° "¥¼¦¨¥æ" ¦¹­È¹ï©ó Like "*¦¨¥æ*" ¬O True)

Select Case ¸û±`¥Î©ó "¦P¤@ÅܼÆ(©Î¼Ðªº)" ©ó¤£¦P­È¤U»Ý¦³¤£¦Pªº³B²z¤è¦¡(§Y«D³æ¯ÂÂǥѤ½¦¡©Îµ{¦¡´N¯à¹ê²{¨ä¥Øªº)®É¨Ï¥Î,(¦³¨Ì¬Y¼Ðªºªº±ø¥ó©Î­È¨Ó°µ "¤À¬y" ªº·N¨ý)
¦Ó If «h¸û±`¥Î©ó¨ã¦³±Æ¥¦©Ê±ø¥óªº»Ý¨D¤U¨Ï¥Î.(¦³¼h¼h¿z¿ïªº·N¨ý)

Select Case «ü¥X­n¤ñ¹ïªº¼Ðªº, ¦Ó Case «h«ü¥X¸Ó¼ÐªºÀ³§PÂ_ªº±ø¥ó(¥i¥ÎÃþ¦ü Case Is > 5 ¤§Ãþªº±ø¥ó¦¡)©Î­È ,¤]¦]¬Ò¬°¬Û¦P¼Ðªº,¬GCase¤£»Ý«ü©ú¼Ðªº.
°£«D§A¥Î Select Case True, ¨º»ò©Ò¦³ Case ªº±ø¥ó¼Ðªº³£À³¸Ó¬O¬Û¦Pªº,
§_«h§Y«K«D¸Óá᪺ªº²Ä1­Ó±ø¥ó¦¡¦¨¥ß, ¤]¤£·|°õ¦æ¨ä¤Uªºµ{§Ç,¦Ó¬O·|Ä~Äò¶]¥h§PÂ_¤U¤@­ÓCase¬O§_¦¨¥ß(¤@¥¹¤£¦¨¥ß¥ß¨èµ²§ô),Á`¤§®e©öµo¥Í«D¹w´Áµ²ªG.

¨ä§Î¦¡¬° :
With Target ' ¼ÐªºÀx¦s®æ
  Select Case .Row ' Àx¦s®æ¦C¸¹
    Case 1 ' ­Y¸ÓÀx¦s®æ¦ì©ó²Ä 1 ¦C
   ...
    Case 9 ' ­Y¸ÓÀx¦s®æ¦ì©ó²Ä 3 ¦C, ¦¹³B²Ä 2 ~ 8 ¦C¤£³B²z, ¬G¤£¾A¥Î For ...Next
    ...
    Case 13 ' ²Ä 13 ¦C
   ...
    Case Else ' ­Y¦C¸¹«D¤W­z±¡§Î®É©ó¦¹³B²z
    ...
  End Select
Edn With
­Y¤W¦¡§ï¥Î If ¨Óªí¥Ü,«h¬°
With Target ' ¼ÐªºÀx¦s®æ
   If .Row=1 Then  ' ­Y¸ÓÀx¦s®æ¦ì©ó²Ä 1 ¦C
   ...
    ElseIf .Row= 9 Then ' ­Y¸ÓÀx¦s®æ¦ì©ó²Ä 9 ¦C, (­YÀx¦s®æ¦ì©ó²Ä 2 ~ 8 ¦C«h¤£·|³B²z, ¬G¤£¾A¥Î For ...Next, ©Î¤½¦¡)
    ...
    Elseif .Row=13 Then ' ­Y¸ÓÀx¦s®æ¦ì©ó²Ä 13 ¦C
   ...
    Else ' ­Y¦C¸¹«D¤W­z±¡§Î®É©ó¦¹³B²z
    ...
  End If
Edn With

TOP

ÁÂÁ¡Gluhpro ªá¤F³o»ò¦h®É¶¡»¡©ú¤Îµ¹§ÚvbaªºÆ[©À¡A¯uªº«D±`·PÁ¡I
§Ú·|¦A§V¤Oªº¡I«Ü·PÁ¡I

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD