엑셀매크로용.txt
2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Sub 매크로2()
'
' 매크로2 매크로
'
' 바로 가기 키: Ctrl+Shift+Q
'
Columns("R:R").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("S:S").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("T:T").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("Q:Q").Select
Selection.TextToColumns Destination:=Range("Q1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
Columns("T:T").Select
Selection.ClearContents
Range("Q1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$S$29462").AutoFilter Field:=17, Criteria1:=Array( _
"노르웨이", "뉴질랜드", "대만", "러시아", "말레이지아", "멕시코", "미국", "미얀마", "바레인", "베네주엘라", "베트남", "세네갈", _
"수입산", "아르헨티나", "에쿠아도르", "오만", "인도네시아", "인디아", "일본", "중국", "칠레", "카나다", "콜롬비아", "태국", _
"태평양산", "통가", "페루", "포클랜드", "필리핀", "한국", "호주", "="), Operator:=xlFilterValues
Columns("R:R").Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$S$29462").AutoFilter Field:=17
Range("T2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-3]=RC[-2],RC[-1],IF(ISBLANK(RC[-2]),RC[-3],RC[-2]))"
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T29462")
Range("T2:T29462").Select
Range("T6").Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
Columns("T:T").Select
Selection.Copy
Range("Z1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("R:T").Select
Range("T1").Activate
Application.CutCopyMode = False
Selection.ClearContents
Columns("S:T").Select
Selection.Delete Shift:=xlToLeft
Columns("X:X").Select
Selection.Cut
Range("R1").Select
ActiveSheet.Paste
End Sub