½Ð°Ý¦U¦ì¤j¯« ³o¬qVBA ¤ñ¹ï¦³0¶}ÀYªº¤å¦r¦p¦ó¤ñ¹ïªº¨ì?
- ©«¤l
- 228
- ¥DÃD
- 62
- ºëµØ
- 0
- ¿n¤À
- 364
- ÂI¦W
- 20
- §@·~¨t²Î
- Win 10
- ³nÅ骩¥»
- Office 2007 & 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-3-5
- ³Ì«áµn¿ý
- 2024-9-16
|
½Ð°Ý¦U¦ì¤j¯« ³o¬qVBA ¤ñ¹ï¦³0¶}ÀYªº¤å¦r¦p¦ó¤ñ¹ïªº¨ì?
½Ð°Ý¦U¦ì¤j¯« ³o¬qVBA Module 8 ¤ñ¹ï¦³0¶}ÀYªº¤å¦r¦p¦ó¤ñ¹ïªº¨ì?
1.³o¬O±q¤u§@ªí ³]¤ñ¹ï±ø¥ó²M³æ ¤¤ A Äæ
¤ñ¹ï¤u§@ªí OE No«á¸ê®Æ ¼´¥X
°ÝÃD¡G0310480000 ¦³ 0¦b³Ì«e±ªº ·|µLªk©M¤u§@ªí ³]¤ñ¹ï±ø¥ó²M³æ A Äæ ¤ñ¹ï«á¥X²{¦b
³o¸ÌªºAÄæ¤U±
2.³o¸ÌÀ³¸Ó¥X²{ ¤ñ¹ï«á«½Æªº ¸ê®Æ 0310480000
¦ý¬O¨S¥X²{
½Ð°Ý VBA Module 8 ¸Ì± µ{¦¡n¦p¦óקï©O?
³]¤ñ¹ï±ø¥ó²M³æ
VBA Module 8 µ{¦¡½X¡G
Sub ¶}©l¤ñ¹ï¤£«½Æ()
Dim t1
t1 = Timer '³o¬O²£¥Í¬í¼Æªº MSG
'==============================================================
'¥H¤U¬°±N ¹LÂo³æ¤@Àx¦s®æÂù±ø¥ó«½Æ²M³æ¥ý¶K¹L¨Ó¸Õ¶]¬Ý¬Ý
Dim Ar(32)
Sheets("³]¤ñ¹ï±ø¥ó²M³æ").Select
Sheets("³]¤ñ¹ï±ø¥ó²M³æ").Name = "Sheet1"
Set d = CreateObject("Scripting.Dictionary")
With Sheet1
For Each a In .Range(.[A2], .[A101].End(xlUp))
For i = 0 To 1
Ar(i) = a.Offset(, i).Value
Next i
d(a & "") = Ar
Next
End With
Range("a1").Parent.Name = "³]¤ñ¹ï±ø¥ó²M³æ"
Sheets("¤ñ¹ï«á«½Æ²M³æ").Select
Sheets("¤ñ¹ï«á«½Æ²M³æ").Name = "Sheet2"
'==============================================================
'§R°£ D Ä欰0®ÉªºÀx¦s®æ¤½¦¡¸ê®Æ
Range("D2").Select
For X = 1 To 1
For y = 2 To 101
If ActiveCell(y, X) = 0 Then
ActiveCell(y, X) = ""
Else
End If
Next y
Next X
'==============================================================
With Sheet2
For Each a In .Range(.[D2], .[D101].End(xlUp))
For Each ky In d.keys
If InStr(a, ky) > 0 Then a.Offset(, -3).Resize(, 1) = d(ky): Exit For
Next
Next
End With
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D101"), Type:=xlFillDefault
Range("D2:D101").Select
Range("D2").Select
Range("a1").Parent.Name = "¤ñ¹ï«á«½Æ²M³æ"
'==============================================================
Sheets("¤ñ¹ï«á«½Æ²M³æ").Select
ROW1 = Cells(Rows.Count, "C").End(3).Row
'¤U±3¦Cµ{¦¡¬O¦pªGn¼´¥X2Äæ¥H¤W¸ê®Æ»Ý¶}©ñªºµ{¦¡½X
' If ROW1 > 2 Then
' Range(Cells(1, "C"), Cells(ROW1, "E")).Clear
' End If
'==============================================================
ROW1 = Cells(Rows.Count, "A").End(3).Row
arr = Range("A2:A" & ROW1)
ROW2 = Sheets("³]¤ñ¹ï±ø¥ó²M³æ").Cells(Rows.Count, "A").End(3).Row
'¦pªGn¼´¥X2Äæ¥H¤W¸ê®Æ»Ý¶}©ñªºµ{¦¡½X¡A2Äæ Range("A1:A" & ROW2) n§ï¦¨ Range("A1:B" & ROW2)
Sheets("³]¤ñ¹ï±ø¥ó²M³æ").Range("A1:A" & ROW2).AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Range("A1:A" & ROW1), CopyToRange:=Range( _
"C1:C1"), Unique:=False
'¤W±ªº "C1:C1" ¬°±q¸ê®Æ®w¼´¥X¤ñ¹ï«á¸ê®Æ¡AÅã¥Ü¦b¦¹¤u§@ªí C1:C1
'==============================================================
Sheets("¤ñ¹ï«á«½Æ²M³æ").Range("A:A").NumberFormatLocal = "@" '¥[¤J³o¤@¦æ, ³]¬°[¤å¦r]®æ¦¡
Sheets("¤ñ¹ï«á«½Æ²M³æ").Range("C:C").NumberFormatLocal = "@" '¥[¤J³o¤@¦æ, ³]¬°[¤å¦r]®æ¦¡
Sheets("¤ñ¹ï«á«½Æ²M³æ").Range("D:D").NumberFormatLocal = "@" '¥[¤J³o¤@¦æ, ³]¬°[¤å¦r]®æ¦¡
'==============================================================
Columns("C:C").ColumnWidth = 28
Columns("D:D").ColumnWidth = 32
'==============================================================
'¥H¤U¬O¥Í¦¨ ¤£«½Æ¶µ¥Ø ªº¤u§@ªí
Sheets.Add After:=Sheets(Sheets.Count)
'Sheets(Sheets.Count).Name = "¥¼¤ñ¹ï¨ì²M³æ"
Columns("A:A").ColumnWidth = 28
Columns("B:B").ColumnWidth = 16
Cells(1, 3).Formula = "¡´ ¦¹¬O[¥¼¤ñ¹ï¨ì]²M³æ"
Cells(1, 3).Font.Color = RGB(43, 20, 134)
Cells(1, 3).Font.Bold = True
Cells(1, 6).Formula = "¡´ ¨Ï¥Î¹L«á¥i§R°£¦¹¤u§@ªí"
Cells(1, 6).Font.Color = RGB(128, 13, 32)
Cells(1, 6).Font.Bold = True
Sheets("³]¤ñ¹ï±ø¥ó²M³æ").Range("A1:A" & ROW2).Copy Range("A1")
For i = ROW2 To 2 Step -1
For j = 1 To UBound(arr)
If Cells(i, "A") Like arr(j, 1) Then
Rows(i).Delete
GoTo 1100
End If
Next
1100:
Next
'==============================================================
'¥H¤U¬°Åý²£¥Í ¤u§@ªí ¤£«½Æ¶µ¥Ø ªºA1Àx¦s®æ²£¥Í¦WºÙ
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
'======================================================
'¥H¤U¬°Åã¥ÜVBA Runµ{¦¡ªº®É¶¡
MsgBox "§ì¸ê®Æ§¹¦¨! " & Chr(10) & "¨Ï¥Î®É¶¡¡G" & Round(Timer - t1, 2) & " ¬í" & Chr(10) & "¥¼¤ñ¹ï¨ìªº¸ê®Æ¡A¦@p¦³" & " " & Application.CountA(ActiveSheet.Columns("A:A")) - 1 & " " & "µ§"
'MsgBox "§ì¸ê®Æ§¹¦¨! " & Chr(10) & "¨Ï¥Î®É¶¡¡G" & Round(Timer - t1, 2) & " ¬í" ³o¬O²£¥Í¬í¼Æªº MSG
'==============================================================
End Sub
ÀɮפU¸ü¡G
ABC-20191224.rar (252.99 KB)
|
|
|
|
|
|
|
- ©«¤l
- 228
- ¥DÃD
- 62
- ºëµØ
- 0
- ¿n¤À
- 364
- ÂI¦W
- 20
- §@·~¨t²Î
- Win 10
- ³nÅ骩¥»
- Office 2007 & 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-3-5
- ³Ì«áµn¿ý
- 2024-9-16
|
¤£¦n·N«ä¡A§Úµo²{¦b¤u§@ªí ¤ñ¹ï«½Æ²M³æªºAÄæ¡A¸gÀx¦s®æ¦¡§ï¤å¦r´N¥i¥H¤F¡C |
|
|
|
|
|
|
- ©«¤l
- 228
- ¥DÃD
- 62
- ºëµØ
- 0
- ¿n¤À
- 364
- ÂI¦W
- 20
- §@·~¨t²Î
- Win 10
- ³nÅ骩¥»
- Office 2007 & 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-3-5
- ³Ì«áµn¿ý
- 2024-9-16
|
¦^´_ 1# jeffrey628litw
¤£¦n·N«ä Àɮ׽Чï¥Î³oÓ¸Õ¸Õ¬Ý ·|¤ñ¸û§Ö ¡A¤j®aC½Ï¸`§Ö¼Ö
ÀɮפU¸ü¡G
ABC-20191225.rar (249 KB)
|
|
|
|
|
|
|