Sub ExpRange1()
Dim ExpRng As Range
Set ExpRng = ActiveCell.CurrentRegion
FirstCol = ExpRng.Columns(1).Column
LastCol = FirstCol + ExpRng.Columns.Count - 1
FirstRow = ExpRng.Rows(1).Row
LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "\P2aINTEGRER.txt" For Output As #1
For r = FirstRow To LastRow
For c = FirstCol To LastCol
data = ExpRng.Cells(r, c).Value
If data = "" Then data = ""
If IsNumeric(data) Then data = Val(data)
If c <> LastCol Then
Print #1, data;
'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé
Else
Print #1, data
End If
Next c
Next r
Close #1
End Sub
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres
significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" <exequo@club-internet.fr> a écrit dans le message de
news:3f28e979$0$25431$afc38c87@news.easynet.fr...
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas
comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1()
Dim ExpRng As Range
Set ExpRng = ActiveCell.CurrentRegion
FirstCol = ExpRng.Columns(1).Column
LastCol = FirstCol + ExpRng.Columns.Count - 1
FirstRow = ExpRng.Rows(1).Row
LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1
For r = FirstRow To LastRow
For c = FirstCol To LastCol
data = ExpRng.Cells(r, c).Value
If data = "" Then data = ""
If IsNumeric(data) Then data = Val(data)
If c <> LastCol Then
Print #1, data;
'commenter la ligne ci-dessous pour conserver le délimiteur par
défaut
Print #1, ";"; 'ici le délimiteur personnalisé
Else
Print #1, data
End If
Next c
Next r
Close #1
End Sub
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub
jean michel
merci du tuyau ; je teste !
"Clément Marcotte" a écrit dans le message de news:%
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" a écrit dans le message de news:3f28e979$0$25431$
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub
merci du tuyau ; je teste !
"Clément Marcotte" <clement.marcotte@sympatico.ca> a écrit dans le message
de news:%23xljqV1VDHA.2012@TK2MSFTNGP10.phx.gbl...
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres
significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" <exequo@club-internet.fr> a écrit dans le message de
news:3f28e979$0$25431$afc38c87@news.easynet.fr...
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas
comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1()
Dim ExpRng As Range
Set ExpRng = ActiveCell.CurrentRegion
FirstCol = ExpRng.Columns(1).Column
LastCol = FirstCol + ExpRng.Columns.Count - 1
FirstRow = ExpRng.Rows(1).Row
LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1
For r = FirstRow To LastRow
For c = FirstCol To LastCol
data = ExpRng.Cells(r, c).Value
If data = "" Then data = ""
If IsNumeric(data) Then data = Val(data)
If c <> LastCol Then
Print #1, data;
'commenter la ligne ci-dessous pour conserver le délimiteur par
défaut
Print #1, ";"; 'ici le délimiteur personnalisé
Else
Print #1, data
End If
Next c
Next r
Close #1
End Sub
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub
Esteban
Bonjour , Val( ) utilise le point comme séparateur de décimale. Utile la fonction CStr( ) qui se base sur les paramètres régionaux de ton ordinateur. Ainsi sur un poste configuré en Français CStr("10,532") renvoie 10,532.
Cordialement, Esteban
"jean michel" a écrit dans le message de news:3f2900b8$0$25427$
merci du tuyau ; je teste !
"Clément Marcotte" a écrit dans le message de news:%
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" a écrit dans le message de news:3f28e979$0$25431$
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub
Bonjour ,
Val( ) utilise le point comme séparateur de décimale.
Utile la fonction CStr( ) qui se base sur les paramètres régionaux de ton
ordinateur.
Ainsi sur un poste configuré en Français CStr("10,532") renvoie 10,532.
Cordialement,
Esteban
"jean michel" <exequo@club-internet.fr> a écrit dans le message de
news:3f2900b8$0$25427$afc38c87@news.easynet.fr...
merci du tuyau ; je teste !
"Clément Marcotte" <clement.marcotte@sympatico.ca> a écrit dans le message
de news:%23xljqV1VDHA.2012@TK2MSFTNGP10.phx.gbl...
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres
significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" <exequo@club-internet.fr> a écrit dans le message de
news:3f28e979$0$25431$afc38c87@news.easynet.fr...
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas
comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1()
Dim ExpRng As Range
Set ExpRng = ActiveCell.CurrentRegion
FirstCol = ExpRng.Columns(1).Column
LastCol = FirstCol + ExpRng.Columns.Count - 1
FirstRow = ExpRng.Rows(1).Row
LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1
For r = FirstRow To LastRow
For c = FirstCol To LastCol
data = ExpRng.Cells(r, c).Value
If data = "" Then data = ""
If IsNumeric(data) Then data = Val(data)
If c <> LastCol Then
Print #1, data;
'commenter la ligne ci-dessous pour conserver le délimiteur par
défaut
Print #1, ";"; 'ici le délimiteur personnalisé
Else
Print #1, data
End If
Next c
Next r
Close #1
End Sub
Bonjour , Val( ) utilise le point comme séparateur de décimale. Utile la fonction CStr( ) qui se base sur les paramètres régionaux de ton ordinateur. Ainsi sur un poste configuré en Français CStr("10,532") renvoie 10,532.
Cordialement, Esteban
"jean michel" a écrit dans le message de news:3f2900b8$0$25427$
merci du tuyau ; je teste !
"Clément Marcotte" a écrit dans le message de news:%
Bonjour,
Val() plante quand on a la virgule comme séparateur décimal.
Essaie en remplaçant val() par Csng() (Convert Single (7 chiffres significatifs)) ou Cdbl() (Convert Double (15 chiffres significatifs))
"jean michel" a écrit dans le message de news:3f28e979$0$25431$
Bonjour à toutes et tous
cette macro exporte un fichier excel en .txt ; mais je ne sais pas comment
je pourrais exporter des chiffres apres la virgule.
Sub ExpRange1() Dim ExpRng As Range Set ExpRng = ActiveCell.CurrentRegion FirstCol = ExpRng.Columns(1).Column LastCol = FirstCol + ExpRng.Columns.Count - 1 FirstRow = ExpRng.Rows(1).Row LastRow = FirstRow + ExpRng.Rows.Count - 1
Open ThisWorkbook.Path & "P2aINTEGRER.txt" For Output As #1 For r = FirstRow To LastRow For c = FirstCol To LastCol data = ExpRng.Cells(r, c).Value If data = "" Then data = "" If IsNumeric(data) Then data = Val(data) If c <> LastCol Then Print #1, data; 'commenter la ligne ci-dessous pour conserver le délimiteur par défaut
Print #1, ";"; 'ici le délimiteur personnalisé Else Print #1, data End If Next c Next r Close #1 End Sub