OVH Cloud OVH Cloud

colonne cm suite

7 réponses
Avatar
sasha
ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha

7 réponses

Avatar
anonymousA
Bonjour,

je ne sais pas si ca fait ce que tu veux du point de vue de
l'algorithme mais du point de vue de la syntaxe, il n'y a pas d'erreur
de syntaxe du moins quand je retravaille le texte en fonction de la
troncature par le logiciel de messagerie.

A+

On 6 fév, 10:59, sasha wrote:
ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha


Avatar
sasha
desolée mais j'ai re essayé et j'obtiens toujours mon message d'erreur erreur
de compilation erreur de syntaxe -
--
sasha



Bonjour,

je ne sais pas si ca fait ce que tu veux du point de vue de
l'algorithme mais du point de vue de la syntaxe, il n'y a pas d'erreur
de syntaxe du moins quand je retravaille le texte en fonction de la
troncature par le logiciel de messagerie.

A+

On 6 fév, 10:59, sasha wrote:
ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha







Avatar
MichDenis
Ton code est bon. Sauf que ton code a des lignes qui sont coupées
au mauvais endroit. Tu trouveras la même procédure avec les
petites corrections dans le module 1 du fichier suivant :
http://cjoint.com/?chpVAvkcLh


"sasha" a écrit dans le message de news:

ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha
Avatar
sasha
merci beaucoup je m'en sers de suite
--
sasha



Ton code est bon. Sauf que ton code a des lignes qui sont coupées
au mauvais endroit. Tu trouveras la même procédure avec les
petites corrections dans le module 1 du fichier suivant :
http://cjoint.com/?chpVAvkcLh


"sasha" a écrit dans le message de news:

ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha





Avatar
sasha
Excuses moi d'insister (je t'ai envoyé au mail sur ton adresse hotmail), mais
ds le fichier cjoint.com il n'y a pas de module 1 ..
--
sasha



Ton code est bon. Sauf que ton code a des lignes qui sont coupées
au mauvais endroit. Tu trouveras la même procédure avec les
petites corrections dans le module 1 du fichier suivant :
http://cjoint.com/?chpVAvkcLh


"sasha" a écrit dans le message de news:

ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha





Avatar
MichDenis
Désolé, regarde là :
http://cjoint.com/?cpnXxw3OtB



"sasha" a écrit dans le message de news:

Excuses moi d'insister (je t'ai envoyé au mail sur ton adresse hotmail), mais
ds le fichier cjoint.com il n'y a pas de module 1 ..
--
sasha



Ton code est bon. Sauf que ton code a des lignes qui sont coupées
au mauvais endroit. Tu trouveras la même procédure avec les
petites corrections dans le module 1 du fichier suivant :
http://cjoint.com/?chpVAvkcLh


"sasha" a écrit dans le message de news:

ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha





Avatar
sasha
merci ça marche !!
--
sasha



Désolé, regarde là :
http://cjoint.com/?cpnXxw3OtB



"sasha" a écrit dans le message de news:

Excuses moi d'insister (je t'ai envoyé au mail sur ton adresse hotmail), mais
ds le fichier cjoint.com il n'y a pas de module 1 ..
--
sasha



Ton code est bon. Sauf que ton code a des lignes qui sont coupées
au mauvais endroit. Tu trouveras la même procédure avec les
petites corrections dans le module 1 du fichier suivant :
http://cjoint.com/?chpVAvkcLh


"sasha" a écrit dans le message de news:

ouops j'ai oublie la maco :
Sub colonnesEnCentimetres()
Dim cm As Integer, points As Integer, savewidth As Integer
Dim count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("entrer la largeur de la colonne en cms",
"Largeur de la colonne souhaitée", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "la largeur de" & cm & "est trop large" & Chr(10) &
_
"la valeur maxi est de " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "largeur non valable"
ActiveCell.ColumnWidth = savewidth
Exit Sub
End If
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
count = 0
While (ActiveCell.Width <> points) And (count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
count = count + 1
Wend
End Sub

--
sasha