OVH Cloud OVH Cloud

Largeur cellule....

2 réponses
Avatar
b
Bonjour j'ai un usager qui me fatigue avec ces largeurs de=20
colonne dans excel. a t il une facon de changer la mesure=20
de largeur en pouce plutot qu'en pixel? Ou existe t il une=20
charte qui convertie des pouces a la mesure a entre quand=20
on veut determiner la colonne. Si quelqu'un a une id=E9e=20
gener vous pas ! je n'ai pas que ces choses a faire.!

Merci

B@stien ..=20

2 réponses

Avatar
Bonjour,

se demande:
a t il une facon de changer la mesure de largeur en pouce
plutot qu'en pixel?

Dans un module:

Sub ColumnWidthInInches()

Dim inches As Integer, points As Integer, savewidth
As Integer
Dim lowerwidth As Integer, upwidth As Integer,
curwidth As Integer
Dim Count As Integer

' Turn screen updating off.
Application.ScreenUpdating = False
' Ask for the desired width in inches.
inches = Application.InputBox("Entrez La Largeur de
Colonne Désirée en Pouce", "Largeur de Colonne En Pouce",
Type:=1)
' If the cancel button for the input box is
pressed, exit the
' procedure.
If inches = False Then Exit Sub
' Convert the entered inches to points.
points = Application.InchesToPoints(inches)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If points wanted is greater than points for 255
characters.
If points > ActiveCell.Width Then
' Display a message box (the specified size is
too large), and
' let user know maximum allowed value.
MsgBox "Width of " & inches & " is too large."
& Chr(10) & _
"The maximum value is " & Format
(ActiveCell.Width / 72, _
"0.00"), vbOKOnly + vbExclamation, "Width
Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit out of the Sub from here.
Exit Sub
End If

' Set the lowerwidth and upperwidth variables.
lowerwidth = 0
upwidth = 255
' Set the column width to the middle of the allowed
character range.
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth

' Set the count to 0 so if it can't find an exact
match it won't go
' indefinitely.
Count = 0
' Loop as long as the cell width is different from
width desired
' and the count (iterations) of the loop is less
than 20.
While (ActiveCell.Width <> points) And (Count < 20)
' If active cell width is less than desired
cell width.
If ActiveCell.Width < points Then
' Reset lower width to current width.
lowerwidth = curwidth
' Set current column width to the midpoint
of curwidth and
' upwidth.
Selection.ColumnWidth = (curwidth +
upwidth) / 2
' If active cell width is greater than
desired width.
Else
' Set upwidth to the curwidth.
upwidth = curwidth
' Set column width to the mid point of
curwidth and lower
' width.
Selection.ColumnWidth = (curwidth +
lowerwidth) / 2
End If
' Set curwidth to the width of the column now.
curwidth = ActiveCell.ColumnWidth
' Increment the count counter.
Count = Count + 1
Wend
End Sub


Trouver ça, un jour, quelque part sur le net...Désolé pour
l'auteur :-(

Starwing

-----Message d'origine-----
Bonjour j'ai un usager qui me fatigue avec ces largeurs
de

colonne dans excel. a t il une facon de changer la mesure
de largeur en pouce plutot qu'en pixel? Ou existe t il
une

charte qui convertie des pouces a la mesure a entre quand
on veut determiner la colonne. Si quelqu'un a une idée
gener vous pas ! je n'ai pas que ces choses a faire.!

Merci

..

.



Avatar
Emcy
Salut,
voila une solution pour convertir en cm (mais c'est pas
très précis)
http://www.excelabo.net/xl/lign-col.php

ça te va ?


-----Message d'origine-----
Bonjour j'ai un usager qui me fatigue avec ces largeurs
de

colonne dans excel. a t il une facon de changer la
mesure

de largeur en pouce plutot qu'en pixel? Ou existe t il
une

charte qui convertie des pouces a la mesure a entre
quand

on veut determiner la colonne. Si quelqu'un a une idée
gener vous pas ! je n'ai pas que ces choses a faire.!

Merci

..

.