Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
bonjour JLuc,
essaie avec cette syntaxe :
Columns("A:F").ColumnWidth = 14
ou bien
Range("A1:F1").ColumnWidth = 10
isabelleBonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
bonjour JLuc,
essaie avec cette syntaxe :
Columns("A:F").ColumnWidth = 14
ou bien
Range("A1:F1").ColumnWidth = 10
isabelle
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
bonjour JLuc,
essaie avec cette syntaxe :
Columns("A:F").ColumnWidth = 14
ou bien
Range("A1:F1").ColumnWidth = 10
isabelleBonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
Range("A1").ColumnWidth = Application.CentimetersToPoints(4)
Salutations!
"JLuc" a écrit dans le message de news:
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonjour JLuc,
Range("A1").ColumnWidth = Application.CentimetersToPoints(4)
Salutations!
"JLuc" <ns.jeanluc.laurent@free.fr.ns> a écrit dans le message de news:
mn.25997d5b8abc7e77.40692@free.fr.ns... Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonjour JLuc,
Range("A1").ColumnWidth = Application.CentimetersToPoints(4)
Salutations!
"JLuc" a écrit dans le message de news:
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" <ns.jeanluc.laurent@free.fr.ns> a écrit dans le message de news:
mn.25997d5b8abc7e77.40692@free.fr.ns...
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" <ns.jeanluc.laurent@free.fr.ns> a écrit dans le message de news:
mn.25997d5b8abc7e77.40692@free.fr.ns...
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonjour JLuc,
'================= > 'code Microsoft
'The following Visual Basic for Applications procedures allow you to specify
the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4) devrait
me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 : impossible
de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Bonsour®,
;o)))
essaie en modifiant un peu la macro :
http://www.excelabo.net/xl/cellules.php#cellulescarrées
cela devrait ressembler à ça :
selectionner une zone puis activer la macro
Sub LargeurEn_mm()
Dim WPChar As Double
Dim DInch As Double
Dim Temp As String
Temp = InputBox("largeur en mm?")
DInch = Val(Temp) / 25.4
If DInch > 0 And DInch < 2.5 Then
i = 0
For Each col In ActiveWindow.RangeSelection.Columns
i = i + 1
If i = 1 Then
col.EntireColumn.AutoFit
WPChar = col.Width / col.ColumnWidth
End If
col.ColumnWidth = ((DInch * 72) / WPChar)
Next col
'-----pour les lignes
'----For Each lig In ActiveWindow.RangeSelection.Rows
'----lig.RowHeight = (DInch * 72)
'----Next lig
End If
End Sub
--
n'oubliez pas les FAQ :
http://www.excelabo.net http://dj.joss.free.fr/faq.htm
http://www.faqoe.com http://faqword.free.fr
Bonsour®,
;o)))
essaie en modifiant un peu la macro :
http://www.excelabo.net/xl/cellules.php#cellulescarrées
cela devrait ressembler à ça :
selectionner une zone puis activer la macro
Sub LargeurEn_mm()
Dim WPChar As Double
Dim DInch As Double
Dim Temp As String
Temp = InputBox("largeur en mm?")
DInch = Val(Temp) / 25.4
If DInch > 0 And DInch < 2.5 Then
i = 0
For Each col In ActiveWindow.RangeSelection.Columns
i = i + 1
If i = 1 Then
col.EntireColumn.AutoFit
WPChar = col.Width / col.ColumnWidth
End If
col.ColumnWidth = ((DInch * 72) / WPChar)
Next col
'-----pour les lignes
'----For Each lig In ActiveWindow.RangeSelection.Rows
'----lig.RowHeight = (DInch * 72)
'----Next lig
End If
End Sub
--
n'oubliez pas les FAQ :
http://www.excelabo.net http://dj.joss.free.fr/faq.htm
http://www.faqoe.com http://faqword.free.fr
Bonsour®,
;o)))
essaie en modifiant un peu la macro :
http://www.excelabo.net/xl/cellules.php#cellulescarrées
cela devrait ressembler à ça :
selectionner une zone puis activer la macro
Sub LargeurEn_mm()
Dim WPChar As Double
Dim DInch As Double
Dim Temp As String
Temp = InputBox("largeur en mm?")
DInch = Val(Temp) / 25.4
If DInch > 0 And DInch < 2.5 Then
i = 0
For Each col In ActiveWindow.RangeSelection.Columns
i = i + 1
If i = 1 Then
col.EntireColumn.AutoFit
WPChar = col.Width / col.ColumnWidth
End If
col.ColumnWidth = ((DInch * 72) / WPChar)
Next col
'-----pour les lignes
'----For Each lig In ActiveWindow.RangeSelection.Rows
'----lig.RowHeight = (DInch * 72)
'----Next lig
End If
End Sub
--
n'oubliez pas les FAQ :
http://www.excelabo.net http://dj.joss.free.fr/faq.htm
http://www.faqoe.com http://faqword.free.fr
Ton code est super adapte sauf pour les hauteurs...
*Bonjour ChrisV*,
Ton code est super adapte sauf pour les hauteurs, je demande 1.5 et il me
met 2. Faut que je regarde mieux... ^^Bonjour JLuc,
'================= >> 'code Microsoft
'The following Visual Basic for Applications procedures allow you to
specify the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >>
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs
et astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Ton code est super adapte sauf pour les hauteurs...
*Bonjour ChrisV*,
Ton code est super adapte sauf pour les hauteurs, je demande 1.5 et il me
met 2. Faut que je regarde mieux... ^^
Bonjour JLuc,
'================= >> 'code Microsoft
'The following Visual Basic for Applications procedures allow you to
specify the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >>
ChrisV
"JLuc" <ns.jeanluc.laurent@free.fr.ns> a écrit dans le message de news:
mn.25997d5b8abc7e77.40692@free.fr.ns...
Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs
et astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
Ton code est super adapte sauf pour les hauteurs...
*Bonjour ChrisV*,
Ton code est super adapte sauf pour les hauteurs, je demande 1.5 et il me
met 2. Faut que je regarde mieux... ^^Bonjour JLuc,
'================= >> 'code Microsoft
'The following Visual Basic for Applications procedures allow you to
specify the
'row and column widths in centimeters:
Sub RowHeightInCentimeters()
Dim cm As Integer
' Get the row height in centimeters.
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
' If cancel button not pressed and a value entered.
If cm Then
' Convert and set the row height
Selection.RowHeight = Application.CentimetersToPoints(cm)
End If
End Sub
Sub ColumnWidthInCentimeters()
Dim cm 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 width in inches wanted.
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
' If cancel button for the input box was pressed, exit procedure.
If cm = False Then Exit Sub
' Convert the inches entered to points.
points = Application.CentimetersToPoints(cm)
' Save the current column width setting.
savewidth = ActiveCell.ColumnWidth
' Set the column width to the maximum allowed.
ActiveCell.ColumnWidth = 255
' If the points desired is greater than the points for 255
' characters...
If points > ActiveCell.Width Then
' Display a message box because the size specified is too
' large and give the maximum allowed value.
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
' Reset the column width back to the original.
ActiveCell.ColumnWidth = savewidth
' Exit the Sub.
Exit Sub
End If
' Set the lowerwidth and upper width 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 on indefinitely.
Count = 0
' Loop as long as the cell width in is different from width
' wanted 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 cell 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
'================= >>
ChrisV
"JLuc" a écrit dans le message de news:Bonsoir les lecteurs,
La commande : Columns(1).Width = Application.CentimetersToPoints(4)
devrait me permettre de definir la largeur de la colonne A a 4cm.
pourtant, quand je l'utilise elle me renvoie une erreur 1004 :
impossible de definir la propriete width de la classe range
si je met Range("A:E").Width = elle me renvoie l'erreur 424 objet
requis.
Quelqu'un saurait ce qui se passe ? Dans l'aide (y a pas d'exemple) ils
disent que cette propriete s'applique a un objet range
D'avance, merci
-- JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs
et astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS
--
JLuc
Pensez a regarder ces sites très bien fait, ce sont des mines de trucs et
astuces !
http://www.excelabo.net
http://jacxl.free.fr/
http://dj.joss.free.fr/
C:Program FilesMicrosoft OfficeOffice1036VBALIST.XLS