Demande pour raccourcir un code déclaré trop long par vba [Résolu]

Signaler
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014
-
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014
-
Bonjour à tous,

j'ai écris un code qui sert à charger des données dans différentes cellules.le message d'erreur code trop long apparait lors du lancement.
Y a t il un moyen de raccourcir ce dernier ?

merci

le code:
Sub loadbank()

'enlever le message de confirmation remplacement cellules
Application.DisplayAlerts = False


' loadbank Macro
'bank 1

'
If Range("o25") = 1 Then
    Range("bo6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 1 Then
    Range("bo8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 1 Then
    Range("bo24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 2

'
If Range("o25") = 2 Then
    Range("bp6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 2 Then
    Range("bp8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 2 Then
    Range("bp24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If




' loadbank Macro
'bank 3

'
If Range("o25") = 3 Then
    Range("bq6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 3 Then
    Range("bq8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 3 Then
    Range("bq24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If


' loadbank Macro
'bank 4

'
If Range("o25") = 4 Then
    Range("br6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 4 Then
    Range("br8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 4 Then
    Range("br24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If




' loadbank Macro
'bank 5

'
If Range("o25") = 5 Then
    Range("bs6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 5 Then
    Range("bs8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 5 Then
    Range("bs24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 6

'
If Range("o25") = 6 Then
    Range("bt6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 6 Then
    Range("bt8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 6 Then
    Range("bt24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 7

'
If Range("o25") = 7 Then
    Range("bu6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 7 Then
    Range("bu8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 7 Then
    Range("bu24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If




' loadbank Macro
'bank 8

'
If Range("o25") = 8 Then
    Range("bv6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 8 Then
    Range("bv8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 8 Then
    Range("bv24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 9

'
If Range("o25") = 9 Then
    Range("bw6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 9 Then
    Range("bw8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 9 Then
    Range("bw24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 10

'
If Range("o25") = 10 Then
    Range("bx6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 10 Then
    Range("bx8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste

    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 10 Then
    Range("bx24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 11

'
If Range("o25") = 11 Then
    Range("by6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 11 Then
    Range("by8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste

    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 11 Then
    Range("by24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If


' loadbank Macro
'bank 12

'
If Range("o25") = 12 Then
    Range("bz6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 12 Then
    Range("bz8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz11").Select
    Selection.Copy
    
    Range("bl11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz12").Select
    Selection.Copy
    
    Range("ah63").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz13").Select
    Selection.Copy
    
    Range("bl13").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz14").Select
    Selection.Copy
    
    Range("ah66").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz15").Select
    Selection.Copy
    
    Range("bl15").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz16").Select
    Selection.Copy
    
    Range("ah69").Select
  ActiveSheet.Paste

    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz17").Select
    Selection.Copy
    
    Range("ai36").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz18").Select
    Selection.Copy
    
    Range("ah39").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz19").Select
    Selection.Copy
    
    Range("ah45").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz20").Select
    Selection.Copy
    
    Range("ah42").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz21").Select
    Selection.Copy
    
    Range("ai47").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz22").Select
    Selection.Copy
    
    Range("ah57").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz23").Select
    Selection.Copy
    
    Range("ah60").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 12 Then
    Range("bz24").Select
    Selection.Copy
    
    Range("r7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 
End If



' loadbank Macro
'bank 13

'
If Range("o25") = 13 Then
    Range("ca6").Select
    Selection.Copy
    
    Range("bl6").Select
  ActiveSheet.Paste
    Application.CutCopyMode = False
End If
'
If Range("o25") = 13 Then
    Range("ca7").Select
    Selection.Copy
    
    Range("bl7").Select
     ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
 If Range("o25") = 13 Then
    Range("ca8").Select
    Selection.Copy
    
    Range("bl8").Select
    ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 13 Then
    Range("ca9").Select
    Selection.Copy
    
    Range("ao11").Select
  ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 13 Then
    Range("ca10").Select
    Selection.Copy
    
    Range("bl10").Select
   ActiveSheet.Paste
        
    Application.CutCopyMode = False
End If
'
If Range("o25") = 13 Then
    Range("ca11").Select
    Selection.Copy
    
    Range("bl1

11 réponses

Messages postés
32484
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
16 mai 2021
347
Bonjour.
Oui...il faut le raccourcir en effet..


Deja au lieu de faire des if (o25=1 ..o25=12
... tu pourrais utiliser un SELECT CASE.

ensuite tu fais des copier/coller en pagaille. . Mais tu veux recuperer quoi de tes cellules la mi en forme ou que les valeurs ?

...

Messages postés
18038
Date d'inscription
lundi 7 décembre 2009
Statut
Modérateur
Dernière intervention
11 avril 2018
236
Bonjour,
Tu ne penses tout de même pas que nous allons parcourir tout ce roman et t'en retourner le corrigé !
Nous allons nous contenter de te dire que VBA sait travailler directement avec les objets Excel et qu'il convient de procéder ainsi et non à coups de Select, Copy, Paste, ActiveSheet, Selection etc ...(pas sérieux !)
Exemple :
If Range("o25") = 1 Then
Range("bo6").Select
Selection.Copy

Range("bl6").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
n'est jamais rien d'autre que
If Range("o25") = 1 Then
Range("b16") = Range("bo6")
end if
!!
Sans parler de toutes tes répétitions conditionnelle sur Range("o25")
Intéresse-toi sans plus attendre et de très près à l'instruction Select Case !
Ce que je te dis là n'est- que le B.A.BA de VBA/Excel, dont il est nécessaire que tu apprennes au moins les rudiments.
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014

merci de me répondre
Je suis entièrement débutant en vba, c'est pourquoi mon code est du niveau maternelle ! :)
je ne connais pas encore select case et son application

Pour le principe, je récupère des valeurs diverses (heures, températures ... ) que j'archive dans une une banque de 40 programmes.
et j'appelle toutes ces données pour les recopier dans les cellules du programme que je demande.
si tu as un mail, je peux t'envoyer mon fichier excel
Messages postés
14791
Date d'inscription
vendredi 14 mars 2003
Statut
Modérateur
Dernière intervention
16 mai 2021
155
J'ai fais la coloration syntaxique de ton code, penses-y la prochaines fois (bouton "<>" dans la barre d'outils d'édition)

Note, ton code est trop long, même pour le forum, c'est un signe quand même ...
Messages postés
18038
Date d'inscription
lundi 7 décembre 2009
Statut
Modérateur
Dernière intervention
11 avril 2018
236
"je ne connais pas encore select case et son application"
cela s'apprend et se comprend en quelques 10 minutes (au maximum) ! ouvre ton aide VBA sur Select Case !
"si tu as un mail, je peux t'envoyer mon fichier excel"
cela n'est ni le principe, ni dans l'esprit de ce forum.
Les réponses que tu as reçues sont suffisantes, pour n'importe quel développeur, débutant ou non !
Messages postés
4
Date d'inscription
jeudi 13 février 2014
Statut
Membre
Dernière intervention
15 février 2014

Bonjour,

Voila de quoi t'aider un peux plus

with workbooks("nomduclasseuravecextention").worksheets("nomdelafeuille")
    test = .range("o25")
    Select Case test    ' <= la valeur à tester (ici, la note)
           Case Is = 1         ' <= si la valeur = 1
                  .Range("bl6") = .Range("bo6")
                  .Range("bl7") = .Range("bo7") 
                  ' + toutes les autre valeur avec la même syntaxe
           Case Is = 2         ' <= si la valeur = 2
                  .Range("bl6") = .Range("bp6")
                  .Range("bl7") = .Range("bp7") 
           Case Else            
                   ' <= si la valeur n'est égale à aucune
    End Select
end with


La tu à vraiment tout pour le faire!
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014

merci beaucoup pour ton aide
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014

puis je te demander la différence entre:

test = .range("o25")
Select Case test ' <= la valeur à tester (ici, la note)
Case Is = 1 ' <= si la valeur = 1
.Range("bl6") = .Range("bo6")
.Range("bl7") = .Range("bo7")

et

If Range("o25") = 1 Then

Range("bl6") = Range("bo6")
Range("bl7") = Range("bo7")

qu'est ce qui fait que l'on choisi l un ou l autre ?
Messages postés
32484
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
16 mai 2021
347
PS : lorsque tu postes du code sur le forum, penses à utiliser les balises de code (pour la coloration syntaxique).

=> http://codes-sources.commentcamarche.net/faq/10686-le-nouveau-codes-sources-comment-ca-marche#balises-code


Cordialement,
Jordane
Messages postés
32484
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
16 mai 2021
347
bonjour,
le Select Case remplace l'utilisation de IF en cascase.

Tu peux, grace au select case, tester autant de conditions que tu le souhaites ( dans une syntaxe simplifiée) alors qu'avec IF tu serais obligé d'écrire "plus" de code.

Messages postés
18038
Date d'inscription
lundi 7 décembre 2009
Statut
Modérateur
Dernière intervention
11 avril 2018
236
Pour être un peu plus complet :
Tes expressions conditionnelles basées sur If, telles que tu les avais écrites, sont toutes exécutées/testées ===>>> lenteurs en plus de code lourd.
Dans une instruction Select Case , la condition n'est évaluée qu'une seule fois et le bloc d'instruction est quitté dès que le cas correspond.
Les développeurs adroits savent "jouer" avec cet aspect et il leur arrive donc de mettre les "case" dans l'ordre de la plus grande probabilité d'occurrence à la plus petite.

Il est enfin clair que l'ordre des cases doit être dicté également par la raison :
case < 10
case < 20
case < 30

est logique et sans surprise possible

Serait par contre maladroit d'écrire
case < 10
case < 30
case < 20

Je te laisse en trouver seul la raison (tu devrais facilement- la trouver si tu as lu attentivement le présent message).

________________________
Réponse exacte ? => "REPONSE ACCEPTEE" facilitera les recherches.
Pas d'aide en ligne installée ? => ne comptez pas sur moi pour simplement répéter son contenu. Je n'interviend
Messages postés
7
Date d'inscription
samedi 15 février 2014
Statut
Membre
Dernière intervention
9 mars 2014

merci à tous, ça fonctionne... et avec des km de lignes en moins.