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
| Private Sub cmdExploiter_Click()
Dim nomFichiertraite As Variant
Dim nomFichierSortie As Variant
Dim wkbDonnées As Workbook
Dim wkbNew As Workbook
Dim wshDonnées As Worksheet
Dim wshSortie As Worksheet
Dim NbrLigneFichierX As Integer
Dim i As Long
Dim rngColonneGenotype As Range
ChDir (ThisWorkbook.Path)
nomFichiertraite = Application.GetOpenFilename("Classeur Microsoft Excel (*.xls),*.xls", 1, "Sélectionner le fichier à contenant les données")
If nomFichiertraite = False Then Exit Sub
Workbooks.Open nomFichiertraite
Set wkbNew = Workbooks(Workbooks.Count)
nomFichierSortie = Application.GetSaveAsFilename("", "Classeur MiscrosoftExcel (*.xls), *.xls", 1, _
"FICHIER DE SORTIE POUR DATABASE:taper le nom du fichier de sortie")
If nomFichierSortie = False Then Exit Sub
wkbNew.SaveAs (nomFichierSortie)
wkbNew.Activate 'meme pas sur que ce soit utile
' convercolonne Macro
' Macro pour separer la colonne trial et lieu attention celle ci
' -----------------"C ICI que ca merdouill"----------------------
' /////// Le code de Singular ///////
' En assumant que l'entête de colonne se trouve dans la première ligne de la feuille...
Set rngColonneGenotype = ActiveSheet.Rows(1).Find(What:="genotype")
If Not rngColonneGenotype Is Nothing Then
Set rngColonneGenotype = rngColonneGenotype.EntireColumn
' à partir d'ici, rngColonneGenotype représente toute la colonne...
End If
rngColonneGenotype.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
rngColonneGenotype.Cells(1, 1).Offset(0, -1).FormulaR1C1 = "LIEU"
Columns("N:N").TextToColumns Destination:=Range("N1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 2), Array(2, 1)), TrailingMinusNumbers:=True
End Sub |
Partager