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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
| Sub Thermometre_Report()
'
' Checks whether Negotiation Report includes errors or not
'
Dim SheetDerog As Worksheet
Set SheetDerog = ThisWorkbook.Sheets("Derogation")
With SheetDerog
nerror = 0
Calculate
'Sheets("Derogation").Select
Set Report_Date = .Range("Report_Date")
'Report_Date.Select
DateC = Report_Date
Set Report_SegFamily = .Range("Report_SegFamily")
'Report_SegFamily.Select
SegFamily = Report_SegFamily
Set Report_CapexOpex = .Range("Report_CapexOpex")
'Report_CapexOpex.Select
CapexOpex = Report_CapexOpex
'nerror = nerror + .Range("Report_CapexOpex").FormatConditions.Count
Set Report_BU1 = .Range("Report_BU1")
Set Report_BU2 = .Range("Report_BU2")
Set Report_BU_U = .Range("Report_BU_U")
Set Report_BU_R = .Range("Report_BU_R")
jcount = Report_BU2.Count
icount = Report_BU1.Count
i = 1
Do While i <= icount
If Report_BU1(i) <> "" Then
BU = Report_BU1(i).Offset(0, -1)
i = icount + 1
Else
If i = icount Then
j = 1
Do While j <= jcount
If Report_BU2(j) <> "" Then
BU = Report_BU2(j).Offset(0, -1)
j = jcount + 1
Else
j = j + 1
End If
Loop
End If
i = i + 1
End If
Loop
Set Report_ContractManagerU = .Range("Report_ContractManagerU")
Set Report_ContractManagerR = .Range("Report_ContractManagerR")
If BU <> "Research" Then
'Report_ContractManagerU.Select
If EvaluateFr(Report_ContractManagerU.FormatConditions(1).Formula1) Then
nerror = nerror + 1
Else
ContractManager = Report_ContractManagerU
End If
Else
'Report_ContractManagerR.Select
If EvaluateFr(Report_ContractManagerR.FormatConditions(1).Formula1) Then
nerror = nerror + 1
Else
ContractManager = Report_ContractManagerR
End If
End If
Set Report_Requisitioner = .Range("Report_Requisitioner")
'Report_Requisitioner.Select
Requisitioner = Report_Requisitioner
Set Report_DaNr = .Range("Report_DaNr")
'Report_DaNr.Select
DaNr = Report_DaNr
'nerror = nerror + Range("Report_PrixCurrency").FormatConditions.Count
Set Report_Description = .Range("Report_Description")
'Report_Description.Select
Description = Report_Description
Set Report_ReportNr = .Range("Report_ReportNr")
'Report_ReportNr.Select
If Report_ReportNr = "" Or IsNumeric(compress(Mid(Report_ReportNr, 3, 20))) Then
ReportNr = Report_ReportNr
Else
nerror = nerror + 1
End If
Set Report_Archivage = .Range("Report_Archivage")
'Report_Archivage.Select
Archivage = StrConv(Report_Archivage, vbProperCase)
Set Report_NbOfferInLine = .Range("Report_NbOfferInLine")
'Report_NbOfferInLine.Select
NbOfferInLine = Report_NbOfferInLine
Set Report_BudgetAmount = .Range("Report_BudgetAmount")
'Report_BudgetAmount.Select
BudgetAmount = Report_BudgetAmount
Set Report_BudgetCurrency = .Range("Report_BudgetCurrency")
'Report_BudgetCurrency.Select
BudgetCurrency = Report_BudgetCurrency
Set Report_Comment2 = .Range("Report_Comment2")
Set Report_DerogationNeant = .Range("Report_DerogationNeant")
If UCase(Mid(Report_Comment2, 1, 5)) = "NEANT" Then
Comment2 = ""
Else
Comment2 = "DEROGATION: " & Report_Comment2
End If
DerogationNeant = Report_DerogationNeant
Set Report_Comment3 = .Range("Report_Comment3")
'Report_Comment3.Select
Comment3 = Report_Comment3
Set Report_Seuil1 = .Range("Report_Seuil1")
'Report_Seuil1.Select
Seuil1 = Report_Seuil1
Set Report_Seuil3 = .Range("Report_Seuil3")
'Report_Seuil3.Select
Seuil3 = Report_Seuil3
Calculate
End With
'Sheets("Rapport de Nego").Select
With ThisWorkbook.Sheets("Rapport de Nego")
Set Report_PoNr = .Range("Report_PoNr")
'Report_PoNr.Select
If Report_PoNr = "6500123456" Then
PoNr = ""
Else
PoNr = Report_PoNr
End If
Set Report_Purchaser = .Range("Report_Purchaser")
'Report_Purchaser.Select
'Tu peux aleger tes structures
Purchaser = IIf(Report_PoNr = "6500123456", "", Report_Purchaser)
'Voir même si tu n'utiliser plus Report_Purchaser dans la suite du code ce qui visiblement est le cas de la plupart de tes variables
Purchaser = IIf(Report_PoNr = "6500123456", "", .Range("Report_Purchaser")) 'et dans ce cas tu vires la ligne Set Report_Purchaser = .Range("Report_Purchaser")
'If Report_PoNr = "6500123456" Then
' Purchaser = ""
'Else
' Purchaser = Report_Purchaser
'End If
Set Report_PurchaserGlobal = .Range("Report_PurchaserGlobal")
'Report_PurchaserGlobal.Select
If Report_PoNr = "6500123456" Then
PurchaserGlobal = ""
Else
PurchaserGlobal = Report_PurchaserGlobal
End If
Set Report_ExpenditureRecurrence = .Range("Report_ExpenditureRecurrence")
'Report_ExpenditureRecurrence.Select
If Report_PoNr = "6500123456" Then
ExpenditureRecurrence = ""
Else
ExpenditureRecurrence = Report_ExpenditureRecurrence
End If
Set Report_AvgMarketBLAmount = .Range("Report_AvgMarketBLAmount")
'Report_AvgMarketBLAmount.Select
If Report_PoNr = "6500123456" Then
AvgMarketBLAmount = ""
Else
AvgMarketBLAmount = Report_AvgMarketBLAmount
End If
Set Report_AvgMarketBLCurrency = .Range("Report_AvgMarketBLCurrency")
'Report_AvgMarketBLCurrency.Select
If Report_PoNr = "6500123456" Then
AvgMarketBLCurrency = ""
Else
AvgMarketBLCurrency = Report_AvgMarketBLCurrency
End If
Set Report_MinMarketBLAmount = .Range("Report_MinMarketBLAmount")
'Report_MinMarketBLAmount.Select
If Report_PoNr = "6500123456" Then
MinMarketBLAmount = ""
Else
MinMarketBLAmount = Report_MinMarketBLAmount
End If
Set Report_MinMarketBLCurrency = .Range("Report_MinMarketBLCurrency")
'Report_MinMarketBLCurrency.Select
If Report_PoNr = "6500123456" Then
MinMarketBLCurrency = ""
Else
MinMarketBLCurrency = Report_MinMarketBLCurrency
End If
Set Report_PrixAmount = .Range("Report_PrixAmount")
'Report_PrixAmount.Select
If Report_PoNr = "6500123456" Then
PrixAmount = ""
Else
PrixAmount = Report_PrixAmount
End If
Set Report_PrixCurrency = .Range("Report_PrixCurrency")
'Report_PrixCurrency.Select
If Report_PoNr = "6500123456" Then
PrixCurrency = ""
Else
PrixCurrency = Report_PrixCurrency
End If
Set Report_SupplierName = .Range("Report_SupplierName")
'Report_SupplierName.Select
If Report_PoNr = "6500123456" Then
SupplierName = ""
Else
SupplierName = Report_SupplierName
End If
'idem pour la suite...
Set Report_SupplierNr = Range("Report_SupplierNr")
Report_SupplierNr.Select
If Report_PoNr = "6500123456" Then
SupplierNr = ""
Else
SupplierNr = Report_SupplierNr
End If
Set Report_Comment1 = Range("Report_Comment1")
Report_Comment1.Select
If Report_PoNr = "6500123456" Then
Comment1 = ""
Else
Comment1 = Report_Comment1
End If
Set Report_Negotiator = Range("Report_Negotiator")
Report_Negotiator.Select
If Report_PoNr = "6500123456" Then
Negotiator = ""
Else
Negotiator = Report_Negotiator
End If
Set Report_NegoQualityDetail1 = Range("Report_NegoQualityDetail1")
Set Report_NegoQualityDetail2 = Range("Report_NegoQualityDetail2")
icount = Report_NegoQualityDetail1.Count
jcount = Report_NegoQualityDetail2.Count
Dim NegoQualityDetail(14)
i = 0
Do While i < icount
i = i + 1
'Report_NegoQualityDetail1(i).Select
If Report_PoNr = "6500123456" Then
'A quoi fais tu reference avec NegoQualityDetail(i) ?
NegoQualityDetail(i) = ""
Else
NegoQualityDetail(i) = Report_NegoQualityDetail1(i)
End If
Loop
j = 0
Do While j < jcount
j = j + 1
'Report_NegoQualityDetail2(j).Select
If Report_PoNr = "6500123456" Then
NegoQualityDetail(i + j) = ""
Else
NegoQualityDetail(i + j) = Report_NegoQualityDetail2(j)
End If
Loop
'Ca c'est iinutile je pense, parce que ton fichier est en mode de calcul Auto
Calculate |
Partager