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

[µo°Ý] ¯BÂI¼Æ¹Bºâ³B²z¡A¦bVBA µ{¦¡¤¤¥h©I¥sWORKSHEETªºROUND

¦^´_ 1# jj369963
  1. Sub Replace_Blank()

  2. Columns("A:A").Select


  3.     Selection.Insert Shift:=xlToRight
  4.     Selection.Insert Shift:=xlToRight


  5. Range("A1").Select
  6.     ActiveCell.FormulaR1C1 = "password"

  7.     Range("B1").Select
  8.     ActiveCell.FormulaR1C1 = "user"


  9.     Dim E As Range
  10.     For Each E In Range("f:f").SpecialCells(xlCellTypeConstants)
  11.         E.Value = "'" & Replace(E, ",", "")
  12.     Next


  13. With [H:BC]
  14. .Replace "*,*", "", xlWhole '²M°£½Æ¿ï
  15. End With
  16. With [H:BC] '1~48ÃDªºÄæ¦ì


  17. .Replace 1, "3@", xlWhole '±N1¥Î¤@­Ó¤£±`¥Î²Å¸¹¨ú¥N


  18. .Replace 2, 1, xlWhole '±N2¥Î1¨ú¥N


  19. .Replace 3, 2, xlWhole '±N3¥Î2¨ú¥N


  20. .Replace "3@", 3, xlWhole '±N¤£±`¥Î²Å¸¹¥Î3¨ú¥N


  21. End With
  22. Dim A As Range, Ar(), B As Range
  23. Set Upw = CreateObject("Scripting.Dictionary") '±b±K
  24. Set dic = CreateObject("Scripting.Dictionary") '°Ñ·Ó
  25. fs = ThisWorkbook.Path & "\replace_rule.txt" 'TEXTÀɮצì¸m
  26. Close #1 '­Y¤w¸g¶}±Ò´N¥ýÃö³¬
  27. With Sheets("Sheet0")
  28. Open fs For Input As #1
  29. Do Until EOF(1)
  30.    Line Input #1, mystr
  31.    If InStr(mystr, ",") > 0 Then
  32.    s = InStr(mystr, "(")
  33.    n = InStr(s, mystr, ")")
  34.    mystr = Mid(mystr, s + 1, n - s - 1)
  35.    For Each C In Split(mystr, ",")
  36.      Set A = .Rows(1).Find(C)
  37.      ReDim Preserve Ar(i)
  38.      Ar(i) = Split(A.Address, "$")(1)
  39.      i = i + 1
  40.    Next
  41.    For Each p In Ar
  42.       dic(p) = Ar '°O¿ý¤½¦¡°Ñ·ÓÄæ¦ì
  43.    Next
  44.    Erase Ar: i = 0
  45.    End If
  46. Loop
  47. Close #1
  48. With Sheets("Sheet1")
  49.   For Each A In .Range(.[A2], .[A2].End(xlDown))
  50.      Upw(CStr(A)) = Array(A.Offset(, 3).Value, A.Offset(, 2).Value) '°O¿ý±b±K
  51.   Next
  52. End With
  53. '¨ú¥N½Æ¿ï¦ì¸m
  54. Set A = .Range(.[H2], .Cells(.Rows.Count, "CQ").End(xlUp)).Find("*,*")
  55. If Not A Is Nothing Then
  56. Do
  57. ay = Split(A, ",")
  58. For i = 0 To UBound(ay)
  59. ReDim Preserve Ar(i)
  60. Ar(i) = Val(ay(i))
  61. Next
  62.   A.Value = Round(Application.Average(Ar), 0)
  63.   Erase Ar
  64.   Set A = .Range(.[H2], .Cells(.Rows.Count, "CQ").End(xlUp)).Find("*,*", A)
  65. Loop Until A Is Nothing
  66. End If
  67. i = 0
  68. .Select
  69. For Each A In .Range(.[F2], .Cells(.Rows.Count, "F").End(xlUp))
  70.    A.Offset(, -5).Resize(, 2) = Upw(CStr(A)) '¶ñ¼g±b±K
  71.    r = A.Row
  72.    For Each B In .Range(.Cells(r, "H"), .Cells(r, "CQ"))
  73.       If B = "" Then  '§ä¨ìªÅ®æ
  74.       ay = dic(Split(B.Address, "$")(1))
  75.       If Not IsEmpty(ay) Then '¸ÓÀx¦s®æ¦³³Q¤½¦¡¤Þ¥Î
  76.          For i = 0 To UBound(ay)
  77.          If .Range(ay(i) & r) <> "" Then '¤Þ¥Îªº°Ñ·Ó«DªÅ¥Õ¤~­p¤J°}¦C
  78.            ReDim Preserve Ar(j)
  79.            Ar(j) = Range(ay(i) & r).Value
  80.            j = j + 1
  81.          End If
  82.          Next
  83.         If j > 0 Then B.Value = Application.Round(Application.WorksheetFunction.Average(Ar), 0)
  84.          Erase Ar
  85.          j = 0
  86.       End If
  87.       End If
  88.     Next
  89. Next
  90. End With

  91. Cells.Select
  92.     Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
  93.         "=(COUNTBLANK($A1:$CQ1)>0)*(COUNTA($A1:$CQ1)>0)"
  94.     Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
  95.     With Selection.FormatConditions(1).Interior
  96.         .PatternColorIndex = xlAutomatic
  97.         .ThemeColor = xlThemeColorAccent6
  98.         .TintAndShade = 0.399945066682943
  99.     End With
  100.     Selection.FormatConditions(1).StopIfTrue = True


  101. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : Ãø¦æ¯à¦æ¡AÃø±Ë¯à±Ë¡AÃø¬°¯à¬°¡A¤~¯àª@µØ¦Û§Úªº¤H®æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD