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

[µo°Ý] ³oºØ­«½Æ­È§R°£ªºVBA¸Ó¦p¦ó¼g(2003)

¦^´_ 8# lpk187
ÁÂÁÂ~¥i¥H­C~

½Ð°Ý³o¦æªº·N«ä¬O
Cells(Rows.Count, 1).End(xlUp).Row

¦pªG§Úªº²£«~¦b²ÄM¦C ¦a°Ï¦b²ÄQ¦C  ¸ê®ÆÁ`¦@¨ìAD¦C
¬O­n§ï¦¨
arr = Range("a2:AD" & Cells(Rows.Count, 1).End(xlUp).Row)

­n«ç»ò­×§ï©O~ÁÂÁÂ

TOP

¦^´_ 9# Hsieh

OK¥i¦æ­C
§Ú¥u¬Ý±oÀ´ Dim A As Range
³Ñ¤U~¦nÃø

¦pªG§Úªº²£«~¦b²ÄM¦C ¦a°Ï¦b²ÄQ¦C  ¸ê®ÆÁ`¦@¨ìAD¦C
­n«ç»ò­×§ï©O~ÁÂÁÂ

TOP

¦^´_ 10# Scott090


    ÁÂÁÂÀ°¦£~¥Ø«e§ÚµLªk¤U¸üÀÉ®×
    ¥u¯à¥ý»¡Án3Q~¤§«á¦A¤U¸ü¬Ý¬Ý¼gªk~~

TOP

¦^´_ 12# terrykyo520

Cells(Rows.Count, 1).End(xlUp).Row¬OAÄ檺³Ì«á¤@®æªº¦C¸¹¡ARows.Count¬°©Ò¦³ªº¦C¸¹¡A1´N¬OAÄæ
­ì¨ÓªºÄæ¼Æ¥u¦³¨Ç3Äæ¡A©Ò¥H¼gªº¤ñ¸û²³æ¡A¦ý¬O­Y¸ê®Æ¼Æ¶q«Ü¦h®É´N¤£¯à¦p¤U­±ªí¥Üªº¼gªk¡A
            arr(j, 1) = ""
            arr(j, 2) = ""
            arr(j, 3) = ""
            ...
            ....
            .......
            .......
            arr(j, X) = ""
³o¼Ë¼g·|²Ö¦ºªº
©Ò¥H¥²¶·¦h¤@­Ó°j°é
  1. Public Sub ex()
  2. Dim ar()
  3. arr = Range("A2:AD" & Cells(Rows.Count, 1).End(xlUp).Row)
  4. K = UBound(arr)
  5. For I = 1 To UBound(arr) - 1
  6.     For j = I + 1 To UBound(arr)
  7.         If arr(I, 1) = "" Or arr(j, 1) = "" Then GoTo 10
  8.         If arr(I, 13) & arr(I, 17) = arr(j, 13) & arr(j, 17) Then
  9.             For L = 1 To UBound(arr, 2)
  10.                 arr(j, L) = ""
  11.             Next
  12.             K = K - 1
  13.         End If
  14. 10:
  15.     Next
  16. Next

  17. ReDim ar(1 To K, 1 To UBound(arr, 2))
  18. K = 1
  19. For I = 1 To UBound(arr)
  20.     If arr(I, 1) <> "" Then
  21.         For L = 1 To UBound(arr, 2)
  22.             ar(K, L) = arr(I, L)
  23.         Next
  24.         K = K + 1
  25.     End If
  26. Next
  27. Range("a2:AD" & Cells(Rows.Count, 1).End(xlUp).Row).Clear
  28. [a2].Resize(UBound(ar), UBound(arr, 2)) = ar
  29. End Sub
½Æ»s¥N½X

TOP

¦^´_ 14# terrykyo520

½Ðª`·N°}¦C°_©l¦ì¸m ¬O 0 ÁÙ¬O 1
¥[ Option base 1 ¬O©w¸q°}¦C±q 1 ¶}©l

°Ñ·Ó 4#

Option base 1   
Sub Test1()
    Dim i&, j&
    Dim aa, bb
   
    i = [A1].End(xlDown).Row
    aa = Range("A2:C" & i).Value
   For i = 1 To UBound(aa) - 1
.........

TOP

¦^´_ 11# GBKEE


³o¨âºØ¤]¥i¥H­C~¦n¦h¤èªk
¦pªG§Úªº²£«~¦b²ÄM¦C ¦a°Ï¦b²ÄQ¦C  ¸ê®ÆÁ`¦@¨ìAD¦C
¬O­n§ï¦¨
Sub Ex()
    Dim R As Range, Rng As Range
    With ActiveSheet.UsedRange
        .Columns("M:Q").AdvancedFilter Action:=xlFilterInPlace, Unique:=True


Sub Ex1()
    Dim Sh As Worksheet, wb As Workbook
    Set Sh = ActiveSheet
    Sh.Copy
    Set wb = ActiveWorkbook
    With wb.Sheets(1)
        .UsedRange.Columns("M:Q").AdvancedFilter Action:=xlFilterInPlace, Unique:=True

§ï³o¨âÃä¶Ü~TKS

TOP

¤£¦n·N«ä­É¼ÐÃD°Ý¤@¤U,

¦³¸ÕµÛ±Nlpk187¤jªºµ{¦¡½X²¤°µ­×§ï,

¦]¬°¹ïVBA¯uªºÁÙ¬O·s¤âµ{«×,©Ò¥H­×§ïªº³¡¥÷°µ±o«Ü¤£¦n,

¥ý²­z¥Ø«e§Æ±æ¹F¨ìªº®ÄªG:
1.­Y¨â¾î¦CªºJÄæ¼Æ­È¤£¦P,LÄæ¼Æ­È¬Û¦P,
«h¶È²M°£¨ä¤¤¤@¾î¦CªºLÄæ¼Æ­È,¨â¾î¦C§¡¤£§R°£.

2.¸ò¤W­z³W«hÃþ¦ü,
­Y¨â¾î¦CªºJÄæ¼Æ­È¬Û¦P,LÄæ¼Æ­È¤£¦P,
«h¶È²M°£¨ä¤¤¤@¾î¦CªºJÄæ¼Æ­È,¨â¾î¦C§¡¤£§R°£.

3.­Y¨â¾î¦CªºJÄæ¼Æ­È¤ÎLÄæ¼Æ­È§¡¬°ªÅ¥Õ,
«h¨â¾î¦C§¡§R°£.
­×§ï«áµ{¦¡½X¦p¤U:
  1. Public Sub extwo()
  2. Dim ar()
  3. Range("c2").Resize(Cells(Rows.Count, 3).End(xlUp).Row, 1).Select
  4. Selection.Resize(Selection.Rows.Count - 1, 1).Select
  5. Selection.Copy Range("a2")

  6. arr = Range("A2:AD" & Cells(Rows.Count, 1).End(xlUp).Row)
  7. K = UBound(arr)
  8. For i = 1 To UBound(arr) - 1
  9.     For j = i + 1 To UBound(arr)
  10.         If arr(i, 1) = "" Or arr(j, 1) = "" Then GoTo 10
  11.         If arr(i, 11) & arr(i, 13) = arr(j, 11) & arr(j, 13) Then
  12.             For L = 1 To UBound(arr, 2)
  13.                 arr(j, L) = ""
  14.             Next
  15.             K = K - 1
  16.         ElseIf arr(i, 11) = arr(j, 11) And arr(i, 13) <> arr(j, 13) Then
  17.             If arr(i, 13) = "" Then
  18.             arr(i, 11) = ""
  19.             Else
  20.             arr(j, 11) = ""
  21.             End If

  22.         ElseIf arr(i, 11) <> arr(j, 11) And arr(i, 13) = arr(j, 13) Then
  23.             If arr(i, 11) = "" Then
  24.             arr(i, 13) = ""
  25.             Else
  26.             arr(j, 13) = ""
  27.             End If

  28.         ElseIf arr(i, 11) = "" And arr(i, 13) = "" Then
  29.         arr(i, 1) = ""

  30.         ElseIf arr(j, 11) = "" And arr(j, 13) = "" Then
  31.         arr(j, 1) = ""
  32. '
  33.         End If
  34.         
  35. 10:
  36.     Next
  37. Next

  38. ReDim ar(1 To K, 1 To UBound(arr, 2))
  39. K = 1
  40. For i = 1 To UBound(arr)
  41.     If arr(i, 1) <> "" Then
  42.         For L = 1 To UBound(arr, 2)
  43.             ar(K, L) = arr(i, L)
  44.         Next
  45.         K = K + 1
  46.     End If
  47. Next
  48. Range("a2:AD" & Cells(Rows.Count, 1).End(xlUp).Row).Clear
  49. [a2].Resize(UBound(ar), UBound(arr, 2)) = ar

  50. Columns(1).ClearContents
  51. [L2].Select
  52. End Sub
½Æ»s¥N½X
¥Ø«eªº°ÝÃD¦b©ó,

´ú¸Õ¤Ö¶q¸ê®Æ®É(¤ñ¦p»¡10µ§¥H¤º),

¬Ý¦ü¨S¦³°ÝÃD,

¦ý¬O­Y´ú¸Õ¤j¶q¸ê®Æ®É,

¥ÎEXCEL2007ªº¤º«Øªº®æ¦¡¤Æ±ø¥ó³]©w,

¥h¼Ð¥X­«½Æªº­È®É,

·|µo²{ÁÙ¬O¦³«Ü¦h­«½Æ¸ê®Æ¨S³Q§R°£,

»Ý¦A¶]²Ä¤G¦¸µ{¦¡½X,

¤~·|²M°£,

¤£ª¾°ÝÃD¥X¦b­þ¸Ì,

ÁÙ±æ«e½ú¤£§[«üÂI,¤Q¤À·PÁÂ.

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD