MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Jul 27th, 2003, 08:16 AM   #1
The Idea Dude
 
Join Date: Aug 2002
Location: Australia
Posts: 539
Default Square cells

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
The Idea Dude is offline   Reply With Quote
Old Jul 27th, 2003, 08:57 AM   #2
Brian from Maui
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,599
Default Re: Square cells

Quote:
Originally Posted by The Idea Dude
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
See,

http://www.experts-exchange.com/Mana..._10297832.html
Brian from Maui is offline   Reply With Quote
Old Jul 27th, 2003, 12:13 PM   #3
The Idea Dude
 
Join Date: Aug 2002
Location: Australia
Posts: 539
Default Re: Square cells

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
The Idea Dude is offline   Reply With Quote
Old Jul 27th, 2003, 05:27 PM   #4
Barry Katcher
 
Barry Katcher's Avatar
 
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,008
Default Re: Square cells

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

Barry Katcher is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 08:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.