Column And Row Lenght And Width Pixel Values

i need my excel to show a pop up bar which shows the pixel values of the columns and rows width and height sizes im using excel 2007

Free Excel Help Forum

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

How to Resize Rows and Columns in Excel Quickly
Resizing rows and columns in Excel is an easy process. Simply left click in between the columns and drag the mouse ...
AutoFilter with an Excel Macro
This Excel tip shows you how you can use an Excel Macro in order to run a Filter on data within a spreadsheet. Filt ...
OFFSET Function in Excel
The OFFSET function in Excel returns a cell or range reference that is a specified number of rows and columns away ...
Sort Data Alphabetically or Numerically in Excel 2007 and Later
This Excel tip shows you how to Sort Data Alphabetically and Numerically in Excel 2007. This is a great feature to ...

Helpful Excel Macros

Delete Empty Columns
- This macro will delete columns which are completely empty. This means that if there is no data within the entire column
Filter Data Sets on Multiple Columns with Multiple Criteria at Once in Excel - AutoFilter
- This Excel macro allows you to filter a data set on multiple columns and criteria at once. This means that you can filt
Reverse Row or Column Order in a Worksheet
- This macro reverses the order of a selected row or column in excel. It will completely reverse the data.
Filter Data in Excel to Display Records that Contain a Value Between Two Values - AutoFilter.
- This free Excel macro filters data to display only those records or rows that contain a value between two values. For e
Replace Formulas with Values (For The Entire Workbook)
- This macro will convert every formula in an entire workbook into its respective value. This is basically a quick way to

Similar Topics


I have charts that needs to be placed on specific position and have specific sizes on a chartsheet. I use chartobjects(i).plotarea (top, left, width, height) for that. Unfortunately when I set these values they still change, there is some scaling going on in Excel and they won't get the specified size. I have been looking on the internet and finally I found a piece of code which works, but still not good enough, because the legend is also not good positioned

De data for resizing the charts (ChtNew), the legends and the charttitle I get from other charts (ChtOrig). The legend.legendposition of ChtOrig does not have a value but it still have a top,left,height en width which I use.

I show you my code, the part with the for-next is taken from the internet.


with ChtNew.legend
           .Top = ChtOrig.Legend.Top
           .Height = ChtOrig.Legend.Height
           .Left = ChtOrig.Legend.Left
           .Width = ChtOrig.Legend.Width   '* 1.1
           .Top = ChtOrig.Legend.Top + ChtOrig.ChartTitle.Top
end with

With ChtNew.Plotarea
        .Top = ChtOrig.PlotArea.Top
        .Height = ChtOrig.PlotArea.Height
        .Width = ChtOrig.PlotArea.Width
        .Left = ChtOrig.PlotArea.Left
         For i = 1 To ChtOrig.PlotArea.Top
           .Top = i
           If .Top = ChtOrig.PlotArea.Top Then
              Exit For
           End If
        Next i
        For i = 1 To ChtOrig.PlotArea.Height
           .Height = i
           If .Height = ChtOrig.PlotArea.Height Then
              Exit For
           End If
        Next i

        For i = 1 To ChtOrig.PlotArea.Left
           .Left = i
           If .Left = ChtOrig.PlotArea.Left Then
              Exit For
           End If
        Next i
        For i = 1 To ChtOrig.PlotArea.Width
           .Width = i
           If .Width = ChtOrig.PlotArea.Width Then
              Exit For
           End If
        Next i
end with

Anyone know of a way to get the pixel coordinate (say TOP) for a particular row. Currently, i use ActiveSheet.ChartObjects("chart 11").Top = 305 to move my chart to coordinate 305. However, when another user has a different screen resolution that's not the position I want. I need the pixel coordinate of Row 24. Anyone?

Thanks a million.

Greetings Board,

XL 2003, Windows XL Pro

I'm working on a database project and need to match it to an existing XL sheet.

Is there any way to default XL to work with column widths (and row heights) in pixels.

In other words, if I set a width to 10, I would want it to set to 10 pixels. I know the screen will show me the pixel count if I drag and drop, but I want to be able to set the widths and heights.

Thank you.


I am not sure what units the below numbers are in . Is it pixels? The chart properties are usually in inches. example : height is 3.47 and width is 5.3 inches.

But what is the corresponding units when we assign a number to the width and height in the vba code? Any help is appreciated.


' Resize:
sr.Width = awidth
sr.Height = aheight
sr.LockAspectRatio = lockaspect

If sr.Width > 500 Then
sr.Width = 500
End If
If sr.Height > 250 Then
sr.Height = 250
End If

How can I in Excels WorkSheet objects such as PlotArea or Shape using VBA and API determine pixel color at given coordinates. API function GetPixel requires handler - hdc so do Excels objects possess hdc and how can I get it? Or maybe there is another way to read pixel color ?

Is there a way to display the column width and row height of a cell on the
toolbar somewhere, similar to the way it shows the column and row number?

I've looked at the CELL function which has the column width, but not the row
height. Plus if it changes you have to hit F9 to refresh. It would be nice
to see both when you select a cell.


I'd like to know if there are VBA calls that can access individual pixel
data from an image on my spreadsheet. The images are 8-bit greyscale.

Is there a way I can add a button to my toolbar so that when pushed the selection will have it's row height autofitted and the column width autofitted? I paste a lot of data from Access and don't want to have to go through the trouble of selecting all the columns, changing the width, then double clicking in between the columns and rows to get it autofitted.

I know a macro could be created, but I want to be able to use this button on any workbook I open up and without having a macro listed in every workbook I create.

I am using Excel 2003.


Here is my code which I am using to fix the location, height and width of the chart.


        ActiveSheet.Shapes("CHART_XY_1").Left = Cells(1, 1).Left
        ActiveSheet.Shapes("CHART_XY_1").Top = Cells(1, 12).Top
        ActiveChart.Parent.Width = Cells(1, 13).Left - Cells(1, 1).Left
        ActiveChart.Parent.Height = Cells(19, 1).Top - Cells(1, 1).Top

Now the problem I am facing is with function "cells()" which is working fine on excel 2010 but somehow it is giving error on excel 2007.

can some1 tell me what wrong m I doing?
or any other way to fix the location, height and width of chart??

ps: I have to display 4 chart on the same screen , keeping 1 at every 4 corners and also height n width being half of what the screen size is.

Thanks in advance

Hello, I have an ImageBox on my userform and I need to get pixel color when I click anywhere on imagebox picture.

How can I do it?

Thanks in advance.

G'Day! I'm trying to create a excel sheet which will automatically calculate a price based on a given width or height. At the moment we calculate price by manually looking in a price book which has plenty of rows and columns and prices. I want to simplify this by simply entering the dimensions so it automatically calculates price based on the dimensions entered.

you enter width of 1500mm in one field, then 900mm in another field, and next to that it automatically shows the price (based on some price list on another spreadsheet or workbook).

Any Help or Advice?
Cheers Mates!

I have a macro that I need to change column width of cells depending on a cell value.

As in if cell a1 = 1.11, a2=2.22, a3=3.33, I want the width of column b to be changed to 1.11 (a1) etc..

The problem is that a1,b1 and c1 will constantly be changing which is why I cant just set the solumn width values in the macro.

Thanks in advance for any help

HTML Code:

    Selection.ColumnWidth = 31

I need 31 for example to equal whatever value is in cell a1.

Hi all,

How do I find the pixel length of a string, so that I can find if it can be accommodated into a cell with a fixed length.

I could find a similar post in the forum But it was not answered



I have a spreadsheet where I am using drop-down boxes to validate input in a couple of columns. In both cases I am using named ranges as the list which details possible entries.

For one of the columns - the width of the drop down options when you click in a cell is the same width as the column width of that column.

For another column, when you click on a cell, the drop down box is much wider than the width of the column. (I have not used any visual basic in this spreadsheet).

I am wondering why this is and how I can control the width of the drop down box because I have some long entries where it would help to have the width of the drop down box to be greater than the width of the column.


Is there anyway to get excel to not round off when adjusting the column width? For example, I set the column width specifically as such:


            With Selection
            .HorizontalAlignment = xlLeft
            End With
    Selection.ColumnWidth = 8.43

Yet when I check the width afterwards, it is at 8.5

It does this with all the columns where it rounds it off to a single decimal as opposed to two places

Columns need to be formatted to an exact size since they are exported to a formatted text (space deliminated) file format which is very dependant on the column width

Any ideas on how to keep two, and not one decimal place when setting the column width?

Thank You

I am trying to modify a chart sent to me. Cell width is in pixels. How can
I change it to inches.

I want to change the height and width of cells using INCHES, and some versions of excel do allow inches, but other versions use # of characters. How do I switch from # of characters to inches, for specifying row height and column width? Thanks.

Hope you folks can help me out with a strange one.

I have several worksheets formatted in exactly the same way as follows:

Col A - width 4
Col B - hidden
Col C - width 4
Col D - Width 108
Col E - Width 3
Col F - Width 11
Col G - Hidden
Col H - Width 11 & Empty

My print range should be Cols A:G (I have used page setup to set the
scaling to fit 1 page wide by [blank] pages tall, thus each sheet will
print as many pages as required depending on number of rows]

When I have the print range set to A:G only columns A:E show on the
print preview (and also on the actual print out) and when I make print
area A:F only A:C show on the print preview.

To get A:G printed I have to set the print area to A:H.

In all 3 of the examples above when I look at the print preview there
is a blank area on the right hand side of the page where the missing
columns SHOULD be but aren't... ie the size of the page seems to be
formatted correctly to include all the columns i want but they just
don't print unless 1 extra column is selected in the print area.

Has anyone out there experienced this problem before?
Thanks in advance.



Can anyone help I am running Excel in MS Office 2007, I have a Windowsmediaplayer control on a Spreadsheet. I am trying to restrict the Viewsize of a Video with:-


Windowsmediaplayer1.width = 200
Windowsmediaplayer1.Height = 200

However when the Video plays it picks up it's height & width from the video clip in the URL.

Any body have any Ideas how to overcome.



I'm confused.

I'm working my way through a series of steps on my current project and I thought this bit would be easy...

i need various columns to be various widths due to the upload requirements of the IT system. The columns will, mostly,contain text.

In the case of column G it will be arrived at by concatenating two other columns of text.

The column width must be 40 and the text MUST be contained within that column width, i.e. no overhanging appearance.

No problem i thought = Len function. But despite the Len being 40, the characters are wider than the 40 width

I guess i could set the Len to 30 to be "sure" but i'd like to know if there is a VBA solution to set the characters / string to fit within the specific column width.

To summarise: I'd like a VBA code to concate two columns to arrive at text within a maximum column width of 40, deleting the "excess".

Thanks in advance of your help, again Chuf

Hi there - here is something that no-one seems to be able to do: I am trying to get the screen resolutions on a dual monitor setup in Excel 2002.

GetSystemMetrics32(X) gives me some info, as follows - when X is:
(measurements in pixels by the way)

0 - I get the width of the primary monitor
1 - I get the height of the primary monitor
78 - I get the width of the virtual monitor
79 - I get the height of the virtual monitor

The virtual screen is the 2 screens "added together"

For example, if I have 2 monitors side by side:

Monitor 1: Res of 1680 x 1050
Monitor 2: Res of 1600 x 900

I can use GetSystemMetrics32 to get me the width of the primary monitor (1680) and the virtual monitor (3280), thus deducing the 2nd monitor has a width of 3280-1680 = 1600.

HOWEVER - I can't determine the Y height of the second monitor because the virtual monitor is 1050 (The largest of the 2 values)

My thought solutions so far have been to:

a) Somehow set the primary monitor temporarily to 800x600. That way, the Y value of the second monitor would be the Y value of the virtual screen (-ie- 900, as 900 is larger than 600). This is clumsy though, and assumes the second monitor is greater than 800x600.

b) Get the X value for the second monitor first, then somehow set the two screens temporarily one above the other (vertically) as opposed to horizontally. The method that I used to work out the width of the 2nd monitor could then be used to work out the height of the 2nd monitor because the virtual screen would be then 1680x1950, and I could work out the 2nd monitor's height = 1950-1050 = 900. Thats also clumsy though, and I don't know how to change horizontal to vertical in VBA.

Any ideas?

If anyone is interested, I found a way to automatically adjust a row height based on merged cells text. Here's how I did it...

In a cell unmerged and on the same row as the merged cells, enter the formula = merged cells and set the formula cell to the same column width as the combined merged cells. For example: Merged cells are B2:D2, formula in F2 is "=B2". Then set column F width to match merged cells. So if the merged cells combined column width is 30, set column F width 30.

Then in the worksheet VBA, use this code. This will automatically adjust the row height after the text in cell B2 is entered.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 2 Then
End If
End Sub

Happy VBAing.

If my row height is 15 and I want the cells in my sheet to be perfectly square, what column width should I use?

I know I can make them look kinda square, but Im hoping someone knows the exact width and height conversion.
I can increase or decrease the row height if necessary.

Thank you.

Can I determine the position of a call out shape object, specifically the position of the starting node/the lowest node on the "triangle"? I need to figure out to what cell this call out is actually pointing to. This far, I have figured out how to get the width & height, and left & top position of the box. However, this is not accurate enough to predict that "starting node" position as the size of the shapes is different from one file to other files.

For example, as seen on the link below, is there any properties that can return the value of range (in this example, range "A6") or any pixel position somewhere close to there?

Thank you very much. Any answer will be very appreciated.

Hi All,

I'm working on an excel sheet in Office 2007. I've changed my ruler units to mm and gone to the page layout view and want to change my columns to specific widths in mm. It does come up with the width in mm and let me change it however when going back it's adjusted to a slightly different value, for example changing my column width to 15mm it reverts to 14.82mm.

Is there any way to make this absolutely exact?

Thanks a bunch!