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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| Sub Macro28()
'
' Macro28 Macro
'
'
Dim F As Variant
F = Application.GetOpenFilename("csv Files (*.csv), *.csv")
If F = False Then Exit Sub
ThisWorkbook.Sheets(4).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & F, Destination _
:=Range("$A$1"))
.Refresh BackgroundQuery:=False
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
Sheets("temp").Select
Set R = Sheets("temp").Range("A1:Z1").Find("Position debut")
If R Is Nothing Then
MsgBox "la valeur " & "Position debut" & " n'a pas été trouvée"
Exit Sub
End If
Set R2 = Sheets("temp").Range("A1:Z1").Find("Position fin")
If R2 Is Nothing Then
MsgBox "la valeur " & "Position fin" & " n'a pas été trouvée"
Exit Sub
End If
Range(R2.Address & "2:" & R2.Address & "65000").Select
Selection.Copy
Sheets("% de visibilité").Select
Range("B9").Select
ActiveSheet.Paste
Sheets("temp").Select
Range("A1").Select
Application.CutCopyMode = False
Selection.AutoFilter
ActiveSheet.Range("$A$1:$K$235").AutoFilter Field:=3, Criteria1:="Google"
Range(R.Address & "2:" & R.Address & "65000").Select
Selection.Copy
Sheets("Positions").Select
ActiveSheet.Paste
Sheets("temp").Select
Range(R2.Address & "2:" & R2.Address & "65000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Positions").Select
Range("W7").Select
ActiveSheet.Paste
Sheets("temp").Select
ActiveSheet.Range("$A$1:$K$235").AutoFilter Field:=3, Criteria1:="Yahoo"
Range(R.Address & "2:" & R.Address & "65000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Positions").Select
Range("D7").Select
ActiveSheet.Paste
Sheets("temp").Select
Range(R2.Address & "2:" & R2.Address & "65000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Positions").Select
Range("X7").Select
ActiveSheet.Paste
Sheets("temp").Select
ActiveSheet.Range("$A$1:$K$235").AutoFilter Field:=3, Criteria1:="Bing"
Range(R.Address & "2:" & R.Address & "65000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Positions").Select
Range("E7").Select
ActiveSheet.Paste
Sheets("temp").Select
Range(R2.Address & "2:" & R2.Address & "65000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Positions").Select
Range("Y7").Select
ActiveSheet.Paste
Range("C7").Select
End With
End Sub |
Partager