ªð¦^¦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)

¦^´_ 10# luke
°õ¦æ [¼g¤JWork]«e¶·¥ý°õ¦æ [Link] ½T©w¤u§@ªíªº¶W³sµ².
  1. Sub Link()
  2.     Dim D As Object, R As Integer, C As Range, A As Range, Ky As Variant
  3.     Set D = CreateObject("Scripting.Dictionary")
  4.     With Sheets("sheet1")
  5.         Set A = .[A:A].Find([J1], lookat:=xlWhole)
  6.         If [J1] = "" Then Exit Sub
  7.         For Each C In .Range(A, .[A65536].End(xlUp))
  8.             If C & C.Offset(, 1) Like .[I3] & .[J3] Then
  9.                 D(C.Value & D.Count) = C.Resize(, 2).Address(0, 0)
  10.             End If
  11.         Next
  12.         [L:N].Clear
  13.         If D.Count = 0 Then MsgBox "µL²Å¦X¸ê®Æ": Exit Sub
  14.         For Each Ky In D.keys
  15.             R = R + 1
  16.             .Cells(R, "L") = .Range(D(Ky)).Cells(1, 1)
  17.             .Cells(R, "M") = .Range(D(Ky)).Cells(1, 2)
  18.             .Hyperlinks.Add Anchor:=.Cells(R, "N"), Address:="", SubAddress:=D(Ky)
  19.         Next
  20.     End With
  21.     Range("J3").Select
  22. End Sub
  23. Sub ¼g¤JWork()
  24.     Dim Rng(1 To 3) As Range, E As Variant, R As Range
  25.     Set Rng(1) = Sheets("Work").UsedRange.Range("a:a")
  26.     For Each E In Sheets("Sheet1").Hyperlinks                 'ª«¥ó¶°¦X:¤u§@ªíªº¶W³sµ²¡C
  27.         Set Rng(2) = Sheets("Sheet1").Range(E.SubAddress)     '¨î©w: ¶W³sµ²ªºÀx¦s®æ
  28.         For Each R In Rng(1)
  29.             If Rng(2).Cells(1) & Rng(2).Cells(1, 2) = R & R.Cells(1, 2) Then '»P¶W³sµ²Àx¦s®æªº¤º®e¬Û¦P
  30.                 Set Rng(3) = R.CurrentRegion                               '½d³ò¥u¦³AB¨âÄæ
  31.                 'CurrentRegion ÄÝ©Ê ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò¡C°ßŪ¡C
  32.                 Rng(2).CurrentRegion.Copy                                    '½Æ»s:¶W³sµ²Àx¦s®æªº³sÄò½d³ò
  33.                 Rng(3)(1).Insert Shift:=xlDown                               '´¡¤J¶K¤W:¶W³sµ²Àx¦s®æªº³sÄò½d³ò
  34.                 'Rng(3)(1) =>  Rng(3).Cells(1, 1)                            '½d³òªº²Ä¤@­Ó·¡åJ®æ
  35.                 Set Rng(3) = Rng(3).Range("A1:C" & Rng(3).Rows.Count)        '¦h¼W¥[¤@Äæ«O«ù¸ê®Æªº§¹¾ã©Ê (CÄæ¤]­n§R°£)
  36.                 Rng(3).Delete Shift:=xlUp                                    '§R°£: ¤U¤èÀx¦s®æ¤W²¾
  37.                 Exit For
  38.             End If
  39.         Next
  40.     Next
  41.     Set Rng(1) = Sheets("Sheet1").[A:A].Find("END", lookat:=xlWhole)   '[SHEET1]AÄ椤´M§ä: "END"
  42.     Set Rng(1) = Sheets("Sheet1").Range("A1:C" & Rng(1).Row)           '¨î©w½d³ò: AÄæ¨ìCÄæ "END"ªº¦C¸¹
  43.     Rng(1).Copy Sheets("Work").Cells(Sheets("Work").Rows.Count, 1).End(xlUp)
  44.     MsgBox "§¹¦¨"
  45. End Sub
½Æ»s¥N½X
·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

¥»©«³Ì«á¥Ñ 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

¦^´_ 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

¦^´_ 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ª©µªÂÐ

­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

¦^´_ 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

¦^´_ 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

¦^´_ 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

        ÀR«ä¦Û¦b : ¹D¼w¬O´£ª@¦Û§Úªº©ú¿O¡A¤£¸Ó¬O¨þ¥¸§O¤HªºÃ@¤l¡C
ªð¦^¦Cªí ¤W¤@¥DÃD