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

[µo°Ý] ¦p¦ó±q¨âÄ椤´M§ä¥X«ü©w­È

[µo°Ý] ¦p¦ó±q¨âÄ椤´M§ä¥X«ü©w­È

¦U¦ì¥ý¶i

sheet1ªí¬ù¦³4000µ§¸ê®Æ¦C(§tªÅ¥Õ¦C)
VBA¬O§_¥i¥H¿z¿ï¥X¨âÄ椤§¹¥þ¬Û¦Pªº­È¦pªþÀÉ»¡©ú?

·Ð½Ð¤j¤j «e½ú«ü¾É
TEST27.rar (64.3 KB)

¦^´_ 1# luke

­Y¬d­ºµ§¸ê®Æ¦p¤U
  1. Sub Test()
  2. Dim Txt1 As String, Txt2 As String
  3. Txt1 = [D3]
  4. Txt2 = [E3]
  5.   [D3] = IIf(Left(Txt1, 1) = ";", Mid(Txt1, 2, Len(Txt1) - 1), Txt1)
  6.   [E3] = IIf(Left(Txt2, 1) = ";", Mid(Txt2, 2, Len(Txt2) - 1), Txt2)
  7.     Cells.Find(What:=[D3], LookIn:=xlValues).Activate
  8.      i = 1
  9.       Do
  10.        Cells.FindNext(After:=ActiveCell).Activate
  11.         If Cells(ActiveCell.Row, 1).Value = [D3] And Cells(ActiveCell.Row, 2).Value = [E3] Then
  12.          Exit Do
  13.           ElseIf i > 4000 Then
  14.           MsgBox "¬dµL " + [D3] + [E3] & "¸ê®Æ"
  15.          Exit Do
  16.         End If
  17.       i = i + 1
  18.     Loop
  19. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# luke
  1. Option Explicit
  2. Sub Ex()
  3.     Dim R As Range, W As String, Rng As Range
  4.     With ActiveSheet
  5.         W = Application.Phonetic(.[D3:E3])       'µ²¦X¨â¦r¦ê
  6.         For Each R In .Range("A:B").SpecialCells(xlCellTypeConstants).Rows '¦³¸ê®ÆªºÀx¦s®æ
  7.             If W = Application.Phonetic(R) Then
  8.                 If Rng Is Nothing Then
  9.                     Set Rng = R
  10.                 Else
  11.                     Set Rng = Union(Rng, R)
  12.                 End If
  13.             End If
  14.         Next
  15.         If Rng Is Nothing Then
  16.             MsgBox "¬dµL " & .[D3] & .[E3] & "¸ê®Æ"
  17.         Else
  18.             Rng.Select
  19.             MsgBox "¦@ " & Rng.Cells.Count / 2 & "µ§ ¸ê®Æ"
  20.         End If
  21.     End With
  22. End SubEnd Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# GBKEE

ÁÂÁ¶Wª©µªÂÐ

    ­Ysheet1ªíªºA:BÄæ¸ê®Æ°Ï¬O¥Ñ¨â­Ó(©Î¦h­Ó)¤å¦rÀɶפJ,  ¨Ã¦³¡uEND¡vÀɧÀ°Ï¹j
    ¦pªG·Q¸õ¹L²Ä1­Ó¦³¡uEND¡v µ²§À, ¨Ó¶i¦æsheet1ªíD3©ME3ªº¬d¸ß, §YD3¿é¤J¡uDD¡v
    ©ME3¿é¤J¡uZ1¡v  ·|¥ý¸õ¹L²Ä1­Ó¦³¡uEND¡v, µM«á¥Ñ¤U§ä¨ì¦ì©ó²Ä2­Ó¸ê®Æ°Ïªº
    ¡iÀx¦s®æA45¡j¦Ó¤£¬O¡iÀx¦s®æA19¡j.
     
     ¦P²z: sheet1ªíD3¿é¤J¡uBB¡v©ME3¿é¤J¡uX001¡v¬O§_¯à©¹¤U¸õ  
    ¦Ü²Ä2­Ó¸ê®Æ°Ïªº¡iÀx¦s®æA56¡j¦Ó¤£¬O¡iÀx¦s®æA32¡j

    ¥H¤W¬O§_¥i¦æ?
    À³¦p¦ó­×§ïVBA?
TEST27A.rar (30.21 KB)

TOP

¦^´_ 5# luke
  1. Private Sub Auto_open()   'Module1 ©óÀɮ׶}±Ò®É¦Û°Ê°õ¦æªºµ{¦¡,­n©w¸q:"END"°Ï¶ô¦ì¸m
  2.     'Names.Add ¬¡­¶Ã¯¤¤©w¸q·s¦WºÙ
  3.         With sheet1.Range("A:A")
  4.         If Not .Find("END", lookat:=xlWhole) Is Nothing Then
  5.             .Replace "END", "=EX", xlWhole
  6.             '±N"END"´À¥N¬°¤½¦¡,¦]¬°µL®Äªº¤½¦¡,Àx¦s®æ¶Ç¦^¿ù»~­È
  7.             With .SpecialCells(xlCellTypeFormulas, xlErrors)
  8.                 Names.Add "¸ê®Æ°Ï", RefersTo:=.Parent.Range(.Address)
  9.                 .Value = "END"    'Àx¦s®æ¶Ç¦^¿ù»~­È:¦^´_­ì¦r¦ê
  10.             End With
  11.             Names.Add "«ö¶s¦¸¼Æ", 1           '«ö¶s1 ²Ä¤@­Ó¸ê®Æ°Ï
  12.         Else
  13.             Names.Add "«ö¶s¦¸¼Æ", 0           '«ö¶s1
  14.         End If
  15.     End With
  16. End Sub
  17. Sub Ex()
  18.     Dim i As Integer, W As String, Rng As Range
  19.     If [«ö¶s¦¸¼Æ] = 0 Then
  20.         MsgBox "¸ê®Æ°Ï ¨S¦³ END°Ï¶ô "
  21.         Exit Sub
  22.     End If
  23.     With ActiveSheet
  24.         W = Application.Phonetic(.[D3:E3])       'µ²¦X¨â¦r¦ê
  25.         'i = [¸ê®Æ°Ï].Areas([«ö¶s¦¸¼Æ]).Row       '²Ä i ­Ó"END"¸ê®Æ°Ïªº¦C¸¹
  26.         For i = [¸ê®Æ°Ï].Areas([«ö¶s¦¸¼Æ]).Row To [¸ê®Æ°Ï].Areas([¸ê®Æ°Ï].Areas.Count).Row
  27.             If W = Application.Phonetic(.Range("A:B").Rows(i)) Then
  28.                 Names.Add "«ö¶s¦¸¼Æ", [«ö¶s¦¸¼Æ] + 1   '
  29.                 Set Rng = .Range("A:B").Rows(i)
  30.                 Exit For   '§ä¨ì²Ä¤@­Ó Â÷¶}°j°é
  31.             End If
  32.         Next
  33.         If Rng Is Nothing Then
  34.             MsgBox "¬dµL " & .[D3] & .[E3] & "¸ê®Æ"
  35.         Else
  36.             Rng.Select
  37.             MsgBox "§ä¨ì " & Rng.Cells(1, 1).Address(0, 0)
  38.         End If
  39.     End With
  40.      If [¸ê®Æ°Ï].Areas.Count = [«ö¶s¦¸¼Æ] Then Names.Add "«ö¶s¦¸¼Æ", 1     '[«ö¶s¦¸¼Æ] ¦^¨ì²Ä¤@¦¸
  41. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# GBKEE


    ÁÂÁ¶Wª©µªÂÐ

­Ysheet1ªíD3Àx¦s®æ¤º®e©T©w¤£ÅÜ(¤£¦Ò¼{E3Àx¦s®æ), ¦pªG·Q¸õ¹L²Ä1­Ó¦³¡uEND¡v¸ê®Æ°Ï,
µM«á¥Ñ²Ä2­Ó¸ê®Æ°Ï¥h¬d¸ßA:BÄ椤, ¥h°µ¶i¶¥¿z¿ï(¦p¹Ï¤ù©Ò¥Ü)¥X²Å¦XD3Àx¦s®æªº¥þ³¡¸ê®Æ.

¨Ò¦p:D3¿é¤J¡uEEE¡v,±q²Ä2­Ó¸ê®Æ°ÏAÄæ
¥i§ä¥X²Ä45¦C¡B²Ä48¦C©M²Ä51¦C¦@¦³3¦C¦³¡uEEE¡v¬Û¦P­È¦p¤U:

²Ä45¦C EEE¡÷Y01
²Ä48¦C EEE¡÷Y04
²Ä51¦C EEE¡÷Y02

¦p¦ó­×§ïVBA±NA:BÄ椤ªº³o¨Ç²Å¦X¿z¿ï¸ê®Æ½Æ»s¦ÜG:HÄæ?
TEST27B.rar (28.83 KB)
TEST27B.gif

TOP

¦^´_ 6# luke
ªG·Q¸õ¹L²Ä1­Ó¦³¡uEND¡v¸ê®Æ°Ï
¥u¦³1­Ó¡uEND¡v¸ê®Æ°Ï¶Ü??????
½Ð±N°ÝÃD§¹¾ãªº´£¥X¨Ó!!!
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# GBKEE


¦^´_¶Wª©

¥H¤U¬O»¡©ú, ½Ð°Ñ¦Òªþ¥ó{WORKµ²ªG}ªí©Ò¥Üµ²ªG

»¡©ú: ±q[Sheet1ªí]A:CÄæ¶×¤J¤å¦rÀÉ¥i¤À¬°A«¬©MB«¬.
[A«¬]
1.·í¶×¤JA«¬¤å¦rÀÉ·|¦³¡uEND¡v(ºÙ²Ä1­Ó¸ê®Æ°Ï)¤Î/©Î¼Æ¶q¤£µ¥ªº¸ê®Æ°Ï(ºÙ²Ä2­Ó¸ê®Æ°Ï¡B²Ä3­Ó¸ê®Æ°Ï¡B²Ä4¸ê®Æ°Ï¡K¾l¦¹Ãþ±À)¦p±qSheet1ªíA:CÄæ©Ò¥Ü, ¨ä¤¤²Ä1­Ó¸ê®Æ°Ï±a¦³ªÅ¥Õ¸ê®Æ¦C, ¦Ó²Ä2­Ó¸ê®Æ°Ï¥H«á, ¨C­Ó¸ê®Æ°Ï¦³¼Æ¶q¤£µ¥¸ê®Æ¦C(¦ý¤£§tªÅ¥Õ¸ê®Æ¦C). [Sheet1ªí]G:IÄæ¬O¥ÑD3Àx¦s®æ(E3¥ÎY*)¬°°µ¬d¸ß¨Ã¥ý¸õ¹L¡uEND¡v¦A¦æ§ä¥X¿z¿ïµ²ªG. ¨Ò¦p:D3¿é¤J¡uEEE¡v®É·|§ä¥X²Å¦XªºY01, Y04©MY02¦@3µ§¸ê®Æ, µM«áÅã¥Üµ²ªG(¦pG1:I3)©óSheet1ªíG:IÄæ(IÄ榳¶W³sµ²¥\¯à).

2.[WORKªí]¬O¸ê®Æ¼g¤J¤u§@ªí,¨ä³Ì«á1¦C¦³1­Ó¡uEND¡vÀɧÀ(¤W1¦C¬°ªÅ¥Õ¸ê®Æ¦C), [Sheet1ªí]ªº²Ä1­Ó¸ê®Æ°Ï¬O¥H¦¹¡uEND¡v°µ½Æ»s¥Øªº. ·í¿ï¨ú[Sheet1ªí]ªº²Ä1­Ó¸ê®Æ°Ï«á¦A½Æ»s¦Ü[WORKªí]¨ÃÂл\¡uEND¡v¶K¤W. ­YA«¬¤å¦rÀÉÁÙ¦³¨ä¥Lªº¸ê®Æ°Ï´N­n°µ¬Û¤¬´M§ä»P´¡¤J(½Æ»s¶K¤W)¥\¯à; ¨Ã§Q¥Î¤W­z¿z¿ïµ²ªG, ¥Ñ[WORKªí] G:HÄæ¶}©l¥ý§ä¥XG1©MH1¤º®e¦pG1=¡uEEE¡v©MH1=¡uY01¡v(¥»¨Ò¦p²Ä1ÂI»¡©ú)¶i¦æ[Sheet1ªí]ªº²Ä2­Ó¸ê®Æ°Ï(¦pA13:C14)°µ½Æ»s, µM«á¤Á´«¦Ü[WORKªí]¥h§ä¨ì²Å¦X[Sheet1ªí] G1=¡uEEE¡v©MH1=¡uY01¡vªº¦ì§}, ±N[Sheet1ªí]ªº²Ä2­Ó¸ê®Æ°Ï´¡¤J¦¹¦ì§}(¦p[WORKªí]©Ò¥Üµ²ªG).

¦P²z:
Ä~Äò°µ¤U­ÓG2=¡uEEE¡v©MH2=¡uY04¡v¨Ã±N[Sheet1ªí] ªº²Ä3­Ó¸ê®Æ°Ï(¦pA16:C17)°µ½Æ»s¨Ã´¡¤J¦Ü[WORKªí]²Å¦X[Sheet1ªí] G2=¡uEEE¡v©MH2=¡uY04¡vªº¦ì§}. µM«áÄ~Äò°µ¤U­ÓG3=¡uEEE¡v©MH3=¡uY02¡v¨Ã±N[Sheet1ªí] ªº²Ä4­Ó¸ê®Æ°Ï(¦pA19:C21)°µ½Æ»s¨Ã´¡¤J¦Ü[WORKªí]²Å¦X[Sheet1ªí] G3=¡uEEE¡v©MH3=¡uY02¡vªº¦ì§}¡K¾l¦¹Ãþ±À

[B«¬]
·í¶×¤JB«¬¤å¦rÀɦÜ[Sheet1ªí]A:CÄæ(½d¨ÒÅã¥Ü©óL: MÄæ)´N·|¦³¡uMMM¡v°µÀɧÀ, ¦ý¤£·|¦³¡uEND¡v,¨ä¸ê®Æ¬O¥H[Sheet1ªí]D3©ME3¨Ó°µ[WORKªí]§R°£¥\¯à. ­YD3¿é¤J¡uEEE¡v©ME3¿é¤J¡uY15¡v,´N·|¶i¦æ[WORKªí]²Å¦XD3:¡uEEE¡v©ME3:¡uY15¡v¬d¸ß, §ä¨ì¦¹µ§¸ê®Æ(¶È1µ§)ªº¦a§}«á,©¹¤W¿ï¨ú[WORKªí]A:CÄæ°Ï¶ô¸ê®Æ¦C¨Ã°µ¸Ó°Ï¶ô¸ê®Æ¦C§R°£¤u§@, µM«á±NB«¬¤å¦rÀɪº[Sheet1ªí]¸ê®Æ¥þ³¡¿ï¨ú(¦pL3:N8)¨Ã´¡¤J¶K¦Ü[WORKªí]¸Ó³B(¦pC34)§Y§¹¦¨.

À³¦p¦ó­×§ïVBA¹F¨ì³o¼Ëªºµ²ªG?
TEST27B.rar (104.77 KB)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-5-5 21:12 ½s¿è

¦^´_ 8# luke
¤£¦n·N«ä,¬Ý¤F¨â¤Ñ,§A»¡ªº«Ü¸Ô²Ó¦ýÁÙ¬O¬Ý¤£À´
¥i¥Hªþ¤WÀɮתº4­Ó¤u§@ªí¤º®e¬O
1 [SHEET1 A]¤u§@ªí¬O  ¤å¦rÀÉA«¬
2 [SHEET1 B]¤u§@ªí¬O  ¤å¦rÀÉB«¬
3 [A WORK]¤u§@ªí¬O :  ¤å¦rÀÉA«¬ ¶K¤W[A WORK]¤u§@ªí «á °õ¦æ ½Æ»s ´¡¤J ªº½d¨Ò
4 [B WORK]¤u§@ªí¬O :   ¤å¦rÀÉB«¬ ¶K¤W[A WORK]¤u§@ªí «á °õ¦æ §R°£ ´¡¤J ªº½d¨Ò
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ luke ©ó 2013-5-29 06:05 ½s¿è

¦^´_ 9# GBKEE


    ¦^ÂжWª©

    1.[Sheet1ªí]´¡¤J¸ê®Æ¦Ü[WORKªí]¦³4­Ó¸ê®Æ°Ï
        A1:C10
        A13:C16
        A18:C21
        A23:C27
2.°õ¦æ¡u¼g¤JWORK¡v«öÁä®É¦][WORKªí]¦³³¡¥÷¸ê®Æ¦C»P[Sheet1ªí]­«ÂдN·|²£¥Í¿ù»~, ­Y[WORKªí]§ïcopy¤è¦¡, ª½±µ½Æ»s[Sheet1ªí]ªº4­Ó¸ê®Æ°Ï¦Ü[WORKªí]

If D.EXISTS(A.Cells(1, 1) & A.Cells(1, 2)) Then
D(A.Cells(1, 1) & A.Cells(1, 2)).Copy
With A.Resize(1, D(A.Cells(1, 1) & A.Cells(1, 2)).Columns.Count)
.Insert Shift:=xlDown
End With
End If

À³¦p¦ó­×§ï ¤W­zVBA»yªk?

¥H¤W
TEST27D.rar (37.33 KB)

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD