I need to make a cell exactly 1 inch by 1 inch...

dennismjt

New Member
Joined
May 24, 2004
Messages
7
I need to make a cell exactly 1 inch by 1 inch... "Why" has to do with my wife and I wont bore you with it... I cannot find a conversion anywhere from "pixels" to "inches"... Anybody?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
LOL!!
I know why!!

Tip for your honey-do list:

Use the drawing toolbar.
Make a 1" rectangle.
Make the cell the same size...
 
Upvote 0
Something like this may help you out.
Code:
x = Application.DefaultWebOptions.PixelsPerInch
MsgBox x
 
Upvote 0
Row height is set in points, and one point is 1/72 of an inch. So, setting a row height of 72 would print out to a meaurable height of one inch. That's the easy part.

The hard part is column width, because that depends on the font size and type you have formatted for that cell. Column width is set by character widths, which by the way is not an option in condional formatting because of this very reason - - CF cannot change the Excel environment and font types would do just that.

You can come close but maybe never get it exactly right for the column width to be one inch. Look at Application.CentimetersToPoints (one point being .035 centimeters) and multiply that by the average of characters for your font.

The following macro is not perfect, using D4 as the target cell, but it comes close. Tweaking it from here might be more trouble than it is worth but it's your call depending on how strong-willed your wife is.


Sub Test1()
With Range("D4")
Dim ColWidth As Integer
ColWidth = 100
.ColumnWidth = 1
Do While Abs(72 - .Width) <= ColWidth
ColWidth = 72 - .Width
.ColumnWidth = .ColumnWidth + 0.1
Loop
.RowHeight = 72
End With
End Sub
 
Upvote 0
Select the cell whose row height and column width you want to measure, and run one of the macros below. 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

Then, using trial and error, resize the cell width and height until you get as close as possible to 1" x 1".

And yes, I wanna' know why, too.
 
Upvote 0
Dreamboat said:
x = Application.DefaultWebOptions.PatchesPerSquare
MsgBox x

ROFL

Who are you laffing at? 'cause first of all that isn't what I even said. Secondly when I tried it I got 96 and when I set row and column to 96 pixels it printed out as a square inch (or very close, my ruly is a piece of crap).
 
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top