Panodrek
Messages postés130Date d'inscriptionlundi 16 mars 2009StatutMembreDernière intervention16 juillet 2009
-
5 mars 2009 à 14:24
Kirkus
Messages postés1Date d'inscriptionmardi 24 août 2010StatutMembreDernière intervention24 août 2010
-
24 août 2010 à 15:44
Bonjour.
Voici mon problème: Je dois copier coller des colonnes d'une feuille vers une autre feuille créé a partir d'une macro. Jusque là pas de problème. Cependant, lorsque je copie mes colonne, il arrive que certaines ne contiennent aucune valeur, mais je dois quand même les copier cars elles montrent qu'aucun relevé n'a été effectué à la date affichée.
Voici mon code (çà fait brouillon je sais, mais bon, je ne fais pas beaucoup de programmation, j'en ai juste besoin pour m'éviter de faire un travail de bot là...):
Sheets("" & RetourAnn).Select
Select Case RetourCU
Case 1 And Sheets("" & RetourAnn).Range("B4").Value = "Discharge"
Range("B" & cpt & ":B" & cpt1).Select
Selection.Copy
Case 2 And Sheets("" & RetourAnn).Range("C4").Value = "temperature"
Range("C" & cpt & ":C" & cpt1).Select
Selection.Copy
Case 3 And Sheets("" & RetourAnn).Range("D4").Value = "pH"
Range("D" & cpt & ":D" & cpt1).Select
Selection.Copy
Case 4 And Sheets("" & RetourAnn).Range("E4").Value = "conductivity"
Range("E" & cpt & ":E" & cpt1).Select
Selection.Copy
Case 5 And Sheets("" & RetourAnn).Range("F4").Value = "NA+"
Range("F" & cpt & ":F" & cpt1).Select
Selection.Copy
Case 6 And Sheets("" & RetourAnn).Range("G4").Value = "K+"
Range("G" & cpt & ":G" & cpt1).Select
Selection.Copy
Case 7 And Sheets("" & RetourAnn).Range("H4").Value = "Mg2+"
Range("H" & cpt & ":H" & cpt1).Select
Selection.Copy
Case 8 And Sheets("" & RetourAnn).Range("I4").Value = "Ca2+"
Range("I" & cpt & ":I" & cpt1).Select
Selection.Copy
Case 9 And Sheets("" & RetourAnn).Range("J4").Value = "Cl-"
Range("J" & cpt & ":J" & cpt1).Select
Selection.Copy
Case 10 And Sheets("" & RetourAnn).Range("K4").Value = "NO3-"
Range("K" & cpt & ":K" & cpt1).Select
Selection.Copy
Case 11 And Sheets("" & RetourAnn).Range("L4").Value = "SO42-"
Range("L" & cpt & ":L" & cpt1).Select
Selection.Copy
Case 12 And Sheets("" & RetourAnn).Range("M4").Value = "alcalinity"
Range("M" & cpt & ":M" & cpt1).Select
Selection.Copy
Case 13 And Sheets("" & RetourAnn).Range("N4").Value = "HCO3-"
Range("N" & cpt & ":N" & cpt1).Select
Selection.Copy
Case 14 And Sheets("" & RetourAnn).Range("O4").Value = "Si"
Range("O" & cpt & ":O" & cpt1).Select
Selection.Copy
Case 15 And Sheets("" & RetourAnn).Range("P4").Value = "DOC"
Range("P" & cpt & ":P" & cpt1).Select
Selection.Copy
Case 16 And Sheets("" & RetourAnn).Range("Q4").Value = "SPM"
Range("Q" & cpt & ":Q" & cpt1).Select
Selection.Copy
Case 17 And Sheets("" & RetourAnn).Range("C4").Value = "RFm"
Range("C" & cpt & ":C" & cpt1).Select
Selection.Copy
Case 18 And Sheets("" & RetourAnn).Range("D4").Value = "Tmin"
Range("D" & cpt & ":D" & cpt1).Select
Selection.Copy
Case 19 And Sheets("" & RetourAnn).Range("E4").Value = "Tmax(°C)"
Range("E" & cpt & ":E" & cpt1).Select
Selection.Copy
Case 20 And Sheets("" & RetourAnn).Range("F4").Value = "Tmean"
Range("F" & cpt & ":F" & cpt1).Select
Selection.Copy
Case 21 And Sheets("" & RetourAnn).Range("G4").Value = "Hummean"
Range("G" & cpt & ":G" & cpt1).Select
Selection.Copy
Case 22 And Sheets("" & RetourAnn).Range("H4").Value = "GRinstant"
Range("H" & cpt & ":H" & cpt1).Select
Selection.Copy
Case 23 And Sheets("" & RetourAnn).Range("I4").Value = "Grcumul"
Range("I" & cpt & ":I" & cpt1).Select
Selection.Copy
Case 24 And Sheets("" & RetourAnn).Range("J4").Value = "Vwind"
Range("J" & cpt & ":J" & cpt1).Select
Selection.Copy
Case 25 And Sheets("" & RetourAnn).Range("K4").Value = "Dirwind"
Range("K" & cpt & ":K" & cpt1).Select
Selection.Copy
Case 26 And Sheets("" & RetourAnn).Range("L4").Value = "RFday"
Range("L" & cpt & ":L" & cpt1).Select
Selection.Copy
Case 27 And Sheets("" & RetourAnn).Range("M4").Value = "PETday"
Range("M" & cpt & ":M" & cpt1).Select
Selection.Copy
Panodrek
Messages postés130Date d'inscriptionlundi 16 mars 2009StatutMembreDernière intervention16 juillet 2009 5 mars 2009 à 17:41
Bon et ben je vous ai dérangé et emmêlé pour rien, j'ai trouvé ma solution et ai même améliorer le tout. Voila voila, merci quand même à ceux qui se sont aventuré à lire ce sujet !!
Panodrek
Messages postés130Date d'inscriptionlundi 16 mars 2009StatutMembreDernière intervention16 juillet 2009 5 mars 2009 à 14:42
En y réfléchissant de plus près, peut être que le problème vient de la boucle "For" dans laquelle il est implémenté, donc je vais mettre tout le code (en plus allégé, vous avez compris le système du case...):