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

½Ð±Ðª©¥D¤Î¦U¦ì¤j¤j­Ì,¦p¦ó¨Ï¥Îautofilter ³s¦P·Ó¤ù¤]copy¦Ü¥Øªº¦a

½Ð±Ðª©¥D¤Î¦U¦ì¤j¤j­Ì,¦p¦ó¨Ï¥Îautofilter ³s¦P·Ó¤ù¤]copy¦Ü¥Øªº¦a

Dear ¦U¦ìª©¥D¤Î¤j¤j­Ì±z¦n :
¤p§Ì¦³¤@°ÝÃD,¦p¦ó¨Ï¥Îautofilter or advancedfilter ¦b©ó¯S©w±ø¥ó¿z¿ï«á§@½Æ¨îªº°Ê§@,³s¦PÄæ¦ì¤j¤p¤ÎÀx¦s®æ¤º¤§·Ó¤ù
¤w³]©w¹Ï¤ùÄݩʬ°¤j¤p¦ì¸mÀHÀx¦s®æ§ïÅÜ,¤]¦³¨Ï¥ÎpastesAll,¤]§¡¤£±o¨ä¸Ñ,¦A³Â·Ð¦U¦ì¥i¥H¸Ñ¨M¤p§ÌªººÃ´b,·P®¦!

  1. Sub test()
  2. Dim mytbl As Range
  3. [a1].CurrentRegion.ClearContents
  4. Set mytbl = [a1].End(xlToRight).CurrentRegion
  5. Set myQry = [a1]
  6. mytbl.Columns(4).AdvancedFilter xlFilterCopy, copytorange:=myQry, unique:=True
  7. Set myQry = myQry.CurrentRegion
  8. For i = 2 To myQry.Rows.Count
  9.     x = [aa2].End(xlToLeft).Column + 1
  10.     With mytbl
  11.         .AutoFilter 4, myQry.Rows(i)
  12.         .Copy
  13.         Cells(1, x).PasteSpecial xlPasteColumnWidths
  14.         Cells(1, x).PasteSpecial xlPasteAll
  15.         mytbl.AutoFilter
  16.     End With
  17. Next
  18. End Sub
½Æ»s¥N½X
[attach]14880[/attach]

question.zip (484.97 KB)

¦^´_ 1# cmo140497
  1. Sub ex()
  2. Set dic = CreateObject("Scripting.Dictionary")
  3. Dim MyQtb As Range, VRng As Range
  4. Set MyQtb = Range("A1").End(xlToRight).CurrentRegion
  5. Application.ScreenUpdating = False
  6. For Each pic In ActiveSheet.Pictures
  7.    Set a = pic.TopLeftCell.Offset(, 1)
  8.    m = a & a.Offset(, 1)
  9.    Set dic(a & a.Offset(, 1)) = Pictures(pic.Name)
  10. Next
  11. For Each a In Range([A2], [A2].End(xlDown))
  12.    With MyQtb
  13.      .AutoFilter 4, a
  14.      Set Rng = Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
  15.      Set VRng = .SpecialCells(xlCellTypeVisible)
  16.      VRng.Copy
  17.      Rng.PasteSpecial xlPasteColumnWidths
  18.      Rng.PasteSpecial Paste:=xlPasteValues
  19.      .AutoFilter
  20.      r = 1
  21.      Do Until r > Rng.Offset(, 1).End(xlDown).Row - 1
  22.      Set c = Rng.Offset(r, 0)
  23.      dic(c.Offset(, 1) & c.Offset(, 2)).Copy
  24.      c.Select
  25.      ActiveSheet.Paste
  26.      r = r + 1
  27.      Loop
  28.    End With
  29. Next
  30. Application.ScreenUpdating = True
  31. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    Dear ª©¥D±z¦­ :
¦³¤@¤p°ÝÃD,¤£ª¾³o¥¨¶°¬O­þ¸Ì¥X¿ù,¦A³Â·Ð±z¸Ñ¨M¤p§ÌªººÃ´b,·P®¦!

TOP

¦^´_ 2# Hsieh


    ¤£¦n·N«ä,¤p§Ì¨S¦³¸ÑÄÀªº«Ü²M·¡,¤p§Ì¥ÎIÄæ¦ì§@¬°¿z¿ï±ø¥ó,¥ý¿z¿ï¥X¤£­«½Æ¤§no.­È©óAÄæ¦ì,¦A±NAÄæ¦ì¨Ì§Ç·íCriteria,¦A¿z¿ï±N¬Û¦P¤§no.³s¦P¹Ï¤ù,¤@°_½Æ»s¬Û¾F¤§ªÅ¥ÕÄæ¦ì
¦A³Â·Ðª©¥D¸Ñ¨M¤p§ÌªººÃ´b,ÁÂÁ±z!


TOP

¦^´_ 3# cmo140497


    ¤ï¶Õ,§ä¨ì°ÝÃD¤F,AÄæ¦ì,ª©¥D¥H¬°CRITERIA¬O­ì¦³ªº,¤p§Ì¥[¤F¶i¥h,¥t¥~Pictures,¤p§Ì§ï¦¨ActiveSheet.Pictures(pic.Name)
,´N¥i¥H¤F,¤£¦n·N«ä,·PÁª©¥Dªº«ü¾É

TOP

¦^´_ 5# cmo140497
ª½±µ½Æ»s
  1. Option Explicit
  2. Sub Ex()
  3.     Dim mytbl As Range, myQry As Range, P As Pictures, I As Integer
  4.     Application.ScreenUpdating = False
  5.     With Sheets("¤u§@ªí1")
  6.         .Activate
  7.         .[a1].CurrentRegion.ClearContents
  8.         .Range("J1", .[J1].End(xlToRight)).EntireColumn.Clear  '²M°£Â¦³¸ê®Æ (Clear µLªk§R°£¹Ï¤ù)
  9.         Set P = .Pictures                                      '¹Ï¤ù¶°¦X
  10.         For I = P.Count To 1 Step -1
  11.             If Intersect(.Range(P(I).TopLeftCell.Address), .[F:F]) Is Nothing Then '¹Ï¤ù¦ì¸m¤£¦b FÄæ
  12.                 P(I).Delete                                    '¹Ï¤ù §R°£
  13.             End If
  14.         Next
  15.         Set mytbl = .[F:I]
  16.         Set myQry = .[a1]
  17.         mytbl.Columns(4).AdvancedFilter xlFilterCopy, copytorange:=myQry, unique:=True
  18.         Set myQry = myQry.CurrentRegion
  19.         For I = 2 To myQry.Rows.Count
  20.             With mytbl
  21.                 .AutoFilter 4, myQry.Rows(I)
  22.                 .SpecialCells(xlCellTypeVisible).Copy
  23.                 .Parent.Cells(1, .Parent.Columns.Count).End(xlToLeft).Offset(, 1).Select
  24.                 .Parent.Paste
  25.                 'ActiveSheet.Paste
  26.             End With
  27.         Next
  28.     End With
  29.     mytbl.AutoFilter
  30.     myQry.Select
  31.     Application.ScreenUpdating = True
  32. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE


    ·PÁª©¥Dªº«ü¾É,¤p§Ì¤S¾Ç¤F·sªº¤èªk,·P®¦!

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD