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

[µo°Ý] ½Ð±Ð­n¦p¦ó¨Ï¥Î VBA §P§O¤£³W«hÀx¦s®æªº¿ìªk2

¦^´_ 4# stillfish00
§Úµyµy­×§ï¤F³B¸Ìªº½d³ò¡G
°²³] lCol ¥Ø«e­È ¬° 1
  1. '  Sheets(1).Columns(lCol).Cells.Count : 65536
  2. '  Sheets(1).Range(Chr(64 + lCol) & Sheets(1).Rows.Count).End(xlUp).Row : 960
  3. '  Application.CountA(.Columns(lCol).Cells) : 861
½Æ»s¥N½X
±N³B¸Ìªº½d³ò¤©¥HÁY¤p¡A¥HÁקK¯Ó®É³B¸Ì¡G
  1. '  If Application.CountA(.Columns(lCol).Cells) < .Columns(lCol).Cells.Count Then
  2. If Application.CountA(.Columns(lCol).Cells) < .Range(Chr(64 + lCol) & .Rows.Count).End(xlUp).Row Then
½Æ»s¥N½X
¥Ø«e¦b°õ¦æ¹Lµ{¤¤·|¥X²{ 1004 ªº¿ù»~°T®§¡A©Ò¥HÁÙ¦b Debug ¤¤¡C
(À³¥Îµ{¦¡©Îª«¥ó©w¸q¤Wªº¿ù»~)
ÁÂÁ§A¡I

TOP

¦^´_ 4# stillfish00
¤£¦n·N«ä¡ARUN ¨ì²{¦b¤w¸g¹L ¥b­Ó¦h¤p®É (µL¦^À³)¡A
¥i¯àÀɮפӤj¤F§a¡A©ú¤é§Ú¦A¸Õ¸Õ¡AÁÂÁ§A¡I

TOP

¦^´_ 1# c_c_lai
¼g±o®¼¶Ãªº¡A¥]²[«¢~
d1¦r¨å : Address , ­±¿n
d2¦r¨å : ­±¿n , ­Ó¼Æ
¨Ì»Ý¨D¦A¦Û¤v§ï§ï§a
  1. Sub test()
  2.   Dim d1, d2, bCombine As Boolean, lCol As Long
  3.   Dim stripe As Range, stripeOffset As Range, rngTarget As Range
  4.   
  5.   Set d1 = CreateObject("scripting.dictionary")
  6.   With Sheets(1).[A1].CurrentRegion
  7.     .Replace What:="0", Replacement:=""
  8.     For lCol = 1 To .Columns.Count
  9.       If Application.CountA(.Columns(lCol).Cells) < .Columns(lCol).Cells.Count Then
  10.         For Each stripe In .Columns(lCol).SpecialCells(xlCellTypeBlanks).Areas
  11.           If stripe.Column = 1 Then
  12.             Set stripeOffset = stripe
  13.           Else
  14.             Set stripeOffset = .Parent.Range(stripe.Address).Offset(0, -1)
  15.           End If
  16.           bCombine = False
  17.           For Each prev In d1.keys
  18.             If Not Application.Intersect(.Parent.Range(prev), stripeOffset) Is Nothing Then
  19.               If d1.exists(stripe.Address) Then d1.Remove (stripe.Address)
  20.               Set stripe = Union(.Parent.Range(prev), stripe)
  21.               d1.Remove prev
  22.               d1(stripe.Address) = stripe.Count
  23.               Set stripeOffset = Union(stripeOffset, .Parent.Range(prev))
  24.               bCombine = True
  25.             End If
  26.           Next prev
  27.           If Not bCombine Then d1(stripe.Address) = stripe.Count
  28.         Next stripe
  29.       End If
  30.     Next lCol
  31.     .Replace What:="", Replacement:="0"
  32.   End With
  33.   
  34.   Set d2 = CreateObject("scripting.dictionary")
  35.   For Each x In d1.items
  36.     If d2.exists(x) Then
  37.       d2(x) = d2(x) + 1
  38.     Else
  39.       d2(x) = 1
  40.     End If
  41.   Next
  42.   For Each x In d2.keys
  43.     Debug.Print "­±¿n " & x & " : " & d2(x) & "­Ó"
  44.   Next
  45. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# c_c_lai
¹ï¤£°_¡I ¦³Ãö luhpro µ¥¤j¤jªº¦^¤å¡A
§Ú¦b­ìµo¤å "½Ð±Ð­n¦p¦ó¨Ï¥Î VBA §P§O¤£³W«hÀx¦s®æªº¿ìªk"¤¤
¬Ý¤£¨ì (¦³¦¬¨ì"®ø®§"¡B¦ý¶i¥h±ý«ôŪ®É«oµL¦¹¬ÛÃö¦^¤å¤º®e)¡A
·q½Ð¦A¦¸½ç±Ð¡AÁÂÁ§Aµ¥¡C

TOP

¦^´_ 1# c_c_lai
¯u©_©Ç¡I ¤§«e±ý¤W¶Çªºªþ¥ó©ó¦¹¦¸µo¤å¡A³ºµM²ö¦W¦a¦Û°Ê¥þ³¡¥X²{¤F¡A
¹ê¦b¤Ó¦n¤F¡C

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD