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

[µo°Ý] ¦b¤è°}©Î¯x°}¤¤,¥H±ÛÂà¤è¦¡¶ñ¤J­È

¦^´_ 1# ­ã´£³¡ªL
Sub ¥H±ÛÂà¤è¦¡¶ñ¤J­È() §½­­¦b[A1:Z26]
  1. Sub testarr()
  2. arrX 7, 1  '2003 '¶¥¼Æ¶·¬O©_¼Æ,¦p°¸¼Æ°õ¦æ¦³°ïÅ|ªÅ¶¡¤£¨¬ªº¿ù»~
  3. End Sub
½Æ»s¥N½X
Sub Ex()
    '¯x°}¥i¬°5*5,6*6,7*7,..256*256...µøExcelª©¥»
    Dim xNo As Double, Rng As Range, Rc As Double, i As Integer
    ActiveSheet.UsedRange.Clear
    xNo = Application.InputBox("¿é¤J±Æ¦C¼Æ¦r", , 25, Type:=1)
    Rc = Application.Evaluate("CEILING(Sqrt(" & xNo & "),1)")
    If Rc Mod 2 <> 0 Then i = 1
    If Int(Rc / 2) + i > Int(Columns.Count / 2) Then
       MsgBox "¿é¤J±Æ¦C¼Æ¦r" & xNo & "ªºÄæ¦ì¼Æ " & Int(Rc / 2) + i & vbLf & "¤j©ó ¤u§@ªí¤§Á`Äæ¦ì/ 2  =>" & Columns.Count / 2
       End
    End If
    Set Rng = Cells(Int(Rc / 2) + i, Int(Rc / 2) + i)   '¥HA1¬°¬Û¹ï¦ì¸mªº¤¤¤ßÀx¦s®æ
    Rng.Select
    Rng.Interior.Color = vbRed
    Rng = 1
    Do
        '¥k,¤U,¥ª,¤W ¶¶®ÉÄÁ¤è¦V
        Do
            If Rng >= Rc * Rc Then End
            Rng.Offset(, 1) = Rng + 1
            Set Rng = Rng.Offset(, 1)   '¥k²¾¤@Äæ
        Loop Until Rng.Offset(1) = ""   '¤U¤@¦C = ""
        
        Do
            Rng.Offset(1) = Rng + 1
            Set Rng = Rng.Offset(1)      '¤U²¾¤@¦C
        Loop Until Rng.Offset(, -1) = "" '¥ª¤@Äæ = ""
   
        Do
            If Rng >= Rc * Rc Then End
            Rng.Offset(, -1) = Rng + 1
            Set Rng = Rng.Offset(, -1)  '¥ª²¾¤@Äæ
        Loop Until Rng.Offset(-1) = ""  '¤W¤@¦C = ""
   
        Do
            Rng.Offset(-1) = Rng + 1
            Set Rng = Rng.Offset(-1)    '¤W²¾¤@¦C
        Loop Until Rng.Offset(, 1) = "" '¥k¤@Äæ = ""
    Loop
   
End Sub
1

µû¤À¤H¼Æ

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# ­ã´£³¡ªL

¨S¦³¼g±o«Ü¦n¡A¤@¶}©l´N¥u¦Ò¼{¨ì¹ïºÙ©Ê
¦ý¬OÁÙ¬O¦³²Å¦XÃD¥Ø»Ý¨D¡A¶K¤W¨ÓÅý¤j®a«ü¾É¶¶«K­×¥¿­þ¸ÌÁÙ¦³°ÝÃD
  1. Sub testarrX2()  '³o¸Ì°õ¦æ
  2. Cells.Clear
  3. Dim n&: n = 15        '¥u¯à©_¼Æ
  4. Cells(11, 8).Select    '=>¨¬°÷¶ñ¥Rªº¦ì¸m
  5. arrX2 n, n, 0         '©_¼Æ¤è°} ,©T©w­È ,(0=>²Å¸¹ªí¦¡,¤j©ó0¼Æ¦r=>§Ç¦Cªí¥Ü)
  6. End Sub

  7. Sub arrX2(numX&, n&, k&)
  8. Dim cx&, cy&, arr, arr2, arr3
  9. arr = Array(0, 1, 0, -1, 0, 1)
  10. arr2 = Array("¢{", "¢}", "¢|", "¢z", "¡´")
  11. arr3 = Array("", "¡õ", "¡ö", "¡ô", "¡÷")

  12. If numX <> 1 Then
  13.     arrX2 numX - 2, n, k
  14.     p = (numX - 1) / 2  '(¼W¶q)¦ì²¾¶q
  15.     For i = 1 To 4
  16.         For j = 0 To numX - 2   
  17.             cx = ActiveCell.Column + p * arr(i) + arr(i + 1) * (j - p + 1)
  18.             cy = ActiveCell.Row + p * arr(i - 1) + arr(i) * (j - p + 1)
  19.             If k = 0 Then
  20.                 If i = 1 And j = 0 Then
  21.                     Cells(cy, cx) = arr2(0)
  22.                 ElseIf i < 4 And j = numX - 2 Then
  23.                     Cells(cy, cx) = arr2(i)
  24.                 ElseIf j = numX - 2 And numX = n Then
  25.                     Cells(cy, cx) = arr2(i)
  26.                 Else
  27.                     Cells(cy, cx) = arr3(i)
  28.                 End If
  29.             Else
  30.                 k = k + 1
  31.                 Cells(cy, cx) = k
  32.             End If
  33.         Next j
  34.     Next i
  35. Else
  36.     ActiveCell = IIf(k > 0, k, "¡·")
  37. End If
  38. End Sub
½Æ»s¥N½X
1

µû¤À¤H¼Æ

TOP

¦^´_ 9# bobomi

ÁÂÁ´£¨Ñºë¤ß¤§§@,
¤]ÁÂÁ¯S¨Ó°Ñ»P, ·P®¦~~

TOP

¥u·|°ò¥»ªºRange§P©w¤èªk¡A¥H¤Uµ{¦¡½X¨Ñ°Ñ¦Ò¡A
¹ïªì¾ÇVBAªÌÀ³«Ü®e©ö¬Ý±oÀ´¡G
¡Õ¥|½ü©w¦ìªk¡Ö
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
¡@
Sub ¼Æ¦r¯x°}_¥|½ü©w¦ìªk()
Dim N, xR As Range, M(1 To 4) As Range, C%, R%, X%, Y%
N = InputBox("½Ð¿é¤J¤è°}Äæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2): Set M(1) = xR(2)
For i = 2 To 4: Set M(i) = xR: Next
R = 1: C = 2
For j = 1 To N * N
¡@¡@xR = j: Set xR = xR(R, C): X = xR.Row: Y = xR.Column
¡@¡@If X < M(1).Row And Y > M(1).Column Then R = 2: C = 1: Set M(1) = xR
¡@¡@If X > M(2).Row And Y > M(2).Column Then R = 1: C = 0: Set M(2) = xR
¡@¡@If X > M(3).Row And Y < M(3).Column Then R = 0: C = 1: Set M(3) = xR
¡@¡@If X < M(4).Row And Y < M(4).Column Then R = 1: C = 2: Set M(4) = xR
¡@¡@Sleep 10
101: Next
End Sub

'¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
Sub ¤è¦V¯x°}_¥|½ü©w¦ìªk()
Dim N, xR As Range, M(1 To 4) As Range, C%, R%, X%, Y%, T$
N = InputBox("½Ð¿é¤J¤è°}Äæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2): Set M(1) = xR(2)
For i = 2 To 4: Set M(i) = xR: Next
R = 1: C = 2: T = "¡·"
For j = 1 To N * N - 1
¡@¡@If xR = "" Then xR = T
¡@¡@Set xR = xR(R, C): X = xR.Row: Y = xR.Column
¡@¡@If X < M(1).Row And Y > M(1).Column Then R = 2: C = 1: T = "¡õ": Set M(1) = xR: xR = "¢{"
¡@¡@If X > M(2).Row And Y > M(2).Column Then R = 1: C = 0: T = "¡ö": Set M(2) = xR: xR = "¢}"
¡@¡@If X > M(3).Row And Y < M(3).Column Then R = 0: C = 1: T = "¡ô": Set M(3) = xR: xR = "¢|"
¡@¡@If X < M(4).Row And Y < M(4).Column Then R = 1: C = 2: T = "¡÷": Set M(4) = xR: xR = "¢z"
¡@¡@Sleep 10
101: Next
xR = "¡´"
End Sub
1

µû¤À¤H¼Æ

    • ML089: ºë«~¤å³¹ª÷¿ú + 5

TOP

¡ÕÀ𨤺N¯Áªk¡Ö
Sub ¼Æ¦r¯x°}_À𨤺N¯Áªk()
Dim i&, xR As Range, R&, C&, N
N = InputBox("¿é¤JÄæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2): xR = 1: Set xR = xR(1, 2)
For i = 2 To N * N
¡@¡@If xR(1, 0) <> "" And xR(2, 1) = "" Then R = 2: C = 1
¡@¡@If xR(0, 1) <> "" And xR(1, 0) = "" Then R = 1: C = 0
¡@¡@If xR(1, 2) <> "" And xR(0, 1) = "" Then R = 0: C = 1
¡@¡@If xR(2, 1) <> "" And xR(1, 2) = "" Then R = 1: C = 2
¡@¡@xR = i:  Set xR = xR(R, C)
¡@¡@Sleep 10
Next i
End Sub
¡@
'¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
Sub ¤è¦V¯x°}_À𨤺N¯Áªk()
Dim i&, xR As Range, R&, C&, T$, N
N = InputBox("¿é¤JÄæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2):  xR = "¡·":  Set xR = xR(1, 2)
For i = 2 To N * N - 1
    If xR(1, 0) <> "" And xR(2, 1) = "" And xR(0, 1) = "" Then R = 2: C = 1: xR = "¢{": T = "¡õ"
    If xR(0, 1) <> "" And xR(1, 0) = "" And xR(1, 2) = "" Then R = 1: C = 0: xR = "¢}": T = "¡ö"
    If xR(1, 2) <> "" And xR(0, 1) = "" And xR(2, 1) = "" Then R = 0: C = 1: xR = "¢|": T = "¡ô"
    If xR(2, 1) <> "" And xR(1, 2) = "" And xR(1, 0) = "" Then R = 1: C = 2: xR = "¢z": T = "¡÷"
    If xR = "" Then xR = T
    Set xR = xR(R, C)
    Sleep 10
Next i
xR = "¡´"
End Sub
1

µû¤À¤H¼Æ

    • ML089: ºë«~¤å³¹ª÷¿ú + 5

TOP

¡Õ¤Q¦r«DªÅÀˬdªk¡Ö
Sub ¼Æ¦r¯x°}_¤Q¦r«DªÅÀˬdªk()
Dim i&, xR As Range, R&, C&, N, j&, k&
N = InputBox("¿é¤JÄæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2): xR = 1: Set xR = xR(1, 2)
For i = 2 To N * N
¡@¡@For j = 1 To 4
¡@¡@¡@¡@If xR(0, 0).Resize(3, 3).Item(j * 2) <> "" Then k = k & j
¡@¡@Next j
¡@¡@If k < 5 Then R = Mid("1201", k, 1): C = Mid("0112", k, 1)
¡@¡@xR = i:  Set xR = xR(R, C): k = 0
¡@¡@Sleep 10
Next i
End Sub
¡@
'¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
Sub ¤è¦V¯x°}_¤Q¦r«DªÅÀˬdªk()
Dim i&, xR As Range, R&, C&, N, j&, k&, T$
N = InputBox("¿é¤JÄæ¦C¼Æ", , 11)
Cells.ClearContents
Set xR = Cells(N / 2 + 2, N / 2 + 2): xR = "¡·": Set xR = xR(1, 2)
For i = 2 To N * N - 1
¡@¡@For j = 1 To 4
¡@¡@¡@¡@If xR(0, 0).Resize(3, 3).Item(j * 2) <> "" Then k = k & j
¡@¡@Next j
¡@¡@If k < 5 Then
¡@¡@¡@¡@R = Mid("1201", k, 1): C = Mid("0112", k, 1)
¡@¡@¡@¡@T = Mid("¡ö¡õ¡ô¡÷", k, 1): xR = Mid("¢}¢{¢|¢z", k, 1)
¡@¡@End If
¡@¡@If xR = "" Then xR = T
¡@¡@Set xR = xR(R, C): k = 0
¡@¡@Sleep 10
Next i
xR = "¡´"
End Sub
1

µû¤À¤H¼Æ

    • ML089: ºë«~¤å³¹ª÷¿ú + 5

TOP

¦^´_ 1# ­ã´£³¡ªL

¤£ª¾¹D²{¦b¦^·|¤£·|¤Ó±ß~
§Ú¥Î«Üª½Ä±ªº¼gªk¡A¨«¨ì©³´NÂàÅs~
  1. Sub ¤è°}1()
  2. Dim ̊ƒ As Byte
  3. Dim Ãä As Byte
  4. Dim X0 As Byte
  5. Dim Y0 As Byte
  6. Dim n As Integer
  7. Cells(5, 5).CurrentRegion = ""
  8. ̊ƒ = (Cells(1, 2) - 1) / 2
  9. X0 = ̊ƒ + 5: Y0 = ̊ƒ + 5
  10. n = 1: X = X0: Y = Y0: Ãä = 1
  11. Cells(Y, X) = n: n = n + 1
  12. ¦V¥k:
  13. If n = (̊ * 2 + 1) ^ 2 And ̊ < ̊ƒ Then ̊ = ̊ + 1
  14. If n = (Ãä * 2 + 1) ^ 2 And Ãä = Ãä¬É Then GoTo µ²§À
  15. If X + 1 - X0 > Ãä Then GoTo ¦V¤U
  16. X = X + 1: Cells(Y, X) = n: n = n + 1: GoTo ¦V¥k
  17. ¦V¤U:
  18. If Y + 1 - Y0 > Ãä Then GoTo ¦V¥ª
  19. Y = Y + 1: Cells(Y, X) = n: n = n + 1: GoTo ¦V¤U
  20. ¦V¥ª:
  21. If X - 1 - X0 < -Ãä Then GoTo ¦V¤W
  22. X = X - 1: Cells(Y, X) = n: n = n + 1: GoTo ¦V¥ª
  23. ¦V¤W:
  24. If Y - 1 - Y0 < -Ãä Then GoTo ¦V¥k
  25. Y = Y - 1: Cells(Y, X) = n: n = n + 1: GoTo ¦V¤W
  26. µ²§À:
  27. X = X + 1: Cells(Y, X) = n
  28. End Sub

  29. Sub ¤è°}2()
  30. Dim ̊ƒ As Byte
  31. Dim Ãä As Byte
  32. Dim X0 As Byte
  33. Dim Y0 As Byte
  34. Dim n As Integer
  35. Cells(5, 5).CurrentRegion = ""
  36. ̊ƒ = (Cells(1, 2) - 1) / 2
  37. X0 = ̊ƒ + 5: Y0 = ̊ƒ + 5
  38. n = 1: X = X0: Y = Y0: Ãä = 1
  39. Cells(Y, X) = "¡·": n = n + 1
  40. ¦V¥k:
  41. If n = (̊ * 2 + 1) ^ 2 And ̊ < ̊ƒ Then ̊ = ̊ + 1
  42. If n = (Ãä * 2 + 1) ^ 2 And Ãä = Ãä¬É Then GoTo µ²§À
  43. If X + 1 - X0 > Ãä Then GoTo ¦V¤U
  44. X = X + 1
  45. If X - X0 = Ãä Then Cells(Y, X) = "¢{" Else Cells(Y, X) = "¡÷"
  46. n = n + 1: GoTo ¦V¥k
  47. ¦V¤U:
  48. If Y + 1 - Y0 > Ãä Then GoTo ¦V¥ª
  49. Y = Y + 1
  50. If Y - Y0 = Ãä Then Cells(Y, X) = "¢}" Else Cells(Y, X) = "¡õ"
  51. n = n + 1: GoTo ¦V¤U
  52. ¦V¥ª:
  53. If X - 1 - X0 < -Ãä Then GoTo ¦V¤W
  54. X = X - 1
  55. If X - X0 = -Ãä Then Cells(Y, X) = "¢|" Else Cells(Y, X) = "¡ö"
  56. n = n + 1: GoTo ¦V¥ª
  57. ¦V¤W:
  58. If Y - 1 - Y0 < -Ãä Then GoTo ¦V¥k
  59. Y = Y - 1
  60. If Y - Y0 = -Ãä Then Cells(Y, X) = "¢z" Else Cells(Y, X) = "¡ô"
  61. n = n + 1: GoTo ¦V¤W
  62. µ²§À:
  63. X = X + 1: Cells(Y, X) = "¡´"
  64. End Sub
½Æ»s¥N½X

¼Æ¿W.rar (48.65 KB)

±ÛÂà¤è°}.rar (15.84 KB)

1

µû¤À¤H¼Æ

TOP

¦^´_ 17# n7822123


³oÃD¥Øªº¬O¬Ý¤£¦Pªº¸Ñªk, ¶°«ä¼s¸q!
¶Q¸Ñ´ú¸Õ§¹¥þ¥i¥Î, ÁÂÁ°ѻP!

TOP

        ÀR«ä¦Û¦b : ¤ß¤¤±`¦sµ½¸Ñ¡B¥]®e¡B·P«ä¡Bª¾¨¬¡B±¤ºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD