![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Aug 2002
Location: Australia
Posts: 539
|
Hi everyone,
Whats the ratio (width is to height) to get a perfect sqare cell. So in other words, if I make a cell width 10, what height will I make the row to get a square cell ? Thanks |
|
|
|
|
|
#2 | |
|
Join Date: Feb 2002
Posts: 7,599
|
Quote:
http://www.experts-exchange.com/Mana..._10297832.html |
|
|
|
|
|
|
#3 |
|
Join Date: Aug 2002
Location: Australia
Posts: 539
|
THANKS for that
For anyone that looks at this thread, here is the code Sub MakeSquare() Dim WPChar As Double Dim DInch As Double Dim Temp As String Temp = InputBox("Height and width in inches?") DInch = Val(Temp) If DInch > 0 And DInch < 2.5 Then For Each c In ActiveWindow.RangeSelection.Columns WPChar = c.Width / c.ColumnWidth c.ColumnWidth = ((DInch * 72) / WPChar) Next c For Each r In ActiveWindow.RangeSelection.Rows r.RowHeight = (DInch * 72) Next r End If End Sub |
|
|
|
|
|
#4 |
|
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,008
|
As an adjunct, here is some code to display the size of a cell:
Select the cell whose row height and column width you want to measure, and run one of the macros below. Code is placed in the Sheet module or in a General module. Many thanks to Andrew Poulsom, MrExcel message board. 'http://www.mrexcel.com/board2/viewtopic.php?t=53527 Code:
Sub CellSizeInMM()
MsgBox "Row height is " & ActiveCell.EntireRow.Height / 72 * 25.4 & " mm"
MsgBox "Column width is " & ActiveCell.EntireColumn.Width / 72 * 25.4 & " mm"
End Sub
Sub CellSizeInInches()
MsgBox "Row height is " & ActiveCell.EntireRow.Height / 72 & " inches"
MsgBox "Column width is " & ActiveCell.EntireColumn.Width / 72 & " inches"
End Sub
__________________
Barry- Photo Restoration/Enhancement http://www.smiledogproductions.com click below for detour
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|