Email:      Pass:    Pass?
Advertisements


Free Excel Forum

Column And Row Lenght And Width Pixel Values

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

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


Similar Excel Video Tutorials

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







Hi

I have never set column width before, If posibel could someone show me how to do it.

I have a sheet which i would like to set
Rows 5 and downward to height=30:00(40 pixels).
Column at diffrent width.
Column A = 4.43 (36 pixel)
Column B = 6.00 (47 pixel)
Column C = 16.71 (122 pixel)
Column D = 24.57 (177 pixel)
Column E = 15.86 (116 pixel)
Column F = 18.86 (137 pixel)

Not sure how to do this, have looked at lots of answers but more confused now.

If someone can assist.

Regards


Hi,
I have 2 columns of data, one with distances and one with pixel values. Then, i have two columns that also have distances in them, forming a range. I would like to have a formula that looks at the range of values and then looks up those same values in the first column of distances and picks out the max pixel value from that. I tried Dmax, but it seems to only work with the first row because its directly below the criteria labels.

So, for example, I would like to look up the maximum pixel value within the range of distances listed (>.003 and <.023, for example). The columns look like this (with the distance and pixel column being longer, encompassing values throughout the ranges):
Any ideas?

Distance Pixel Distance Distance
0 168 >0.003 <0.023
0.00 176 >0.023 <0.043
0.00 178 >0.053 <0.073
0.001 179 >0.07 <0.09
0.002 155 >0.09 <0.11
0.002 160 >0.122 <0.142
0.002 170
0.003 159
0.003 165
0.004 153
0.004 159
0.005 156
0.005 162
0.005 169
0.006 152
0.006 158
0.007 145
0.007 145
0.007 147
0.008 130
0.008 142
0.009 133
0.009 152
0.01 137
0.01 146
0.01 157
0.011 145
0.011 154
0.012 141
0.012 149
0.013 153
0.013 161.52


LENGTH (m) WIDTH
(m)

HEIGHT
(m)

TOTAL AREA 0-10M 10-20M 20-30M 30-40M 2.00 2.00 12.00 48.00 0.00 0.00 0.00 0.00

Hi there,

I am facing a problem in the above which is,

I have to calculate the value in "0-10M" column in a way that if "Height" is 12 it should do as follows,

Multiply Lenght * Width * 10 (place the value in "0-10M")

and

the balnce from height that is "2" should be multiplied as Lenght * Width * 2 and palce the value in "10-20M".

I hope i have explained it well to get the desired result.

Thanks


Greetings,
This "smells" like a simple question, but I've had no luck finding a way to [programmatically] adjust the App.Window to fit around some cells.

I've found "Application.Goto", also the Application.Width/Height setting. The App.Width setting is pixel based, so if there's an easy way to know a cell's pixel-location, that'll work too!

Thanks/Cheers!


Hi,
I have 3 columns of data. Column A is distance values, column B is pixel values and column C is also pixel values that I want find in column B adn then find the corresponding distance value. It seems like the lookup functions and match function either have to be in ascending order or you can only lookup values in column a and corresponding value in column b. I want to lookup the value in column b and find the corresponding distance in column a. here is the data(col a and b are longer):
any ideas?

thanks


Distance Pixel Pixel value to look up
0.000 168 169
0.000 176 182.105
0.000 178 190.047
0.001 179
0.002 155
0.002 160
0.002 170
0.003 159
0.003 165
0.004 153
0.004 159
0.005 156
0.005 162
0.005 169
0.006 152
0.006 158
0.007 145
0.007 145
0.007 147


Note I was using Visual studio 2010 and Excel 2010 for this!

But I decided to try and colour a sheet from a JPG dont ask me why, but it seemed like a fun application, the first thing I found is that there is a large lack of information but here is the code incase you wish to try!

Code:

Imports System.Drawing
Imports Microsoft.Office.Interop.Excel

Public Class ThisWorkbook

    Private Sub ThisWorkbook_Startup() Handles Me.Startup

        Dim StepSize As Integer = 4 'speed up by only processing every nth pixel

        Dim MyImage As New Bitmap("C:\Users\Daz\Pictures\Elephants\DSCF0789.jpg")

        Dim PixelColor As Color  ' Contains the pixel from the image
        Dim GreyScale As Integer  ' used in converting to greyscale, since it overloads the maximum formatting otherwise


        Me.Application.ScreenUpdating = False
        Me.Application.EnableEvents = False

        For x = 0 To MyImage.Width - 1 Step StepSize
            Me.Sheets(1).Range("A1").offset(1, x / StepSize).columnwidth = 0.2 ' seemed to be 2 pixel wide excel cells
        Next

        For y = 0 To MyImage.Height - 1 Step StepSize
            Me.Sheets(1).Range("A1").offset(y / StepSize, 1).rowheight = 1.8 ' seemed to be 2 pixel wide excel cells

        Next

        For x = 0 To MyImage.Width - 1 Step StepSize
            For y = 0 To MyImage.Height - 1 Step StepSize

                'read pixel from bitmap
                PixelColor = MyImage.GetPixel(x, y)

                ' convert pixel into greyscale
                GreyScale = PixelColor.R * 0.3 + PixelColor.G * 0.59 + PixelColor.B * 0.11
                ' set cell on excel sheet to pixel color
                Me.Sheets(1).Range("A1").offset(y / StepSize, x / StepSize).interior.color = RGB(GreyScale, GreyScale, GreyScale)
            Next
        Next

        ' select image range
        Me.Sheets(1).range("A1:" & Me.Sheets(1).Range("A1").offset(MyImage.Height / StepSize - 1, MyImage.Width / StepSize - 1).address()).select()
        'zoom to full image
        Me.Windows(1).Zoom = True

        Me.Application.EnableEvents = True
        Me.Application.ScreenUpdating = True

        MyImage = Nothing


    End Sub

    Private Sub ThisWorkbook_Shutdown() Handles Me.Shutdown

    End Sub

End Class



The resulting file is here (its too big to post here) :-

http://cid-7c0eef3f7aa6f25b.skydrive...0Pricture.xlsx

ignore the error, as I havent included the compiled code!


For some reason, I cannot get my worksheet to display a cell's pixel value when I make a colum or row wider. Thoughts?


Hi all,

I've got one that has stumped me, I'm tring to set my column widths so that
they fit to the window size however when using different screen sizes and
different pixel sizes I can't get it working in all cases. I am currently
using the function application.width to grab the window size, if anyone can
help me that would be greatly appreciated.

Jason Zischke



In the same workbook I have two sheets that have the same column width of 50, but the pixel count is 355 on one sheet and 710 on the other. This of course causes viewing and printing issues. How does this get corrected?


Hi

Can someone please guide me how i can set the below macro to do loop until it gets to row 450

Column A,B,E & F = 160 Pixel and Column C & D = 28 pixel
Row 1 = 27pixel
Row 2 = 92 pixel
Row 3 = 26 pixel
Row 4 = 3 Pixel


Code:

Sub Set_label_page()
'
' Setup page for label.
'

    Columns("A:A").ColumnWidth = 22.14
    Columns("B:B").ColumnWidth = 22.14
    Columns("E:E").ColumnWidth = 22.14
    Columns("F:F").ColumnWidth = 22.14
    Columns("C:C").ColumnWidth = 3.29
    Columns("D:D").ColumnWidth = 3.29
    Rows("1:1").RowHeight = 20.25
    Rows("2:2").RowHeight = 69
    Rows("3:3").RowHeight = 20.25
    Rows("4:4").RowHeight = 2.25
    Range("A2:B2").Select
        Selection.Merge
    Range("E2:F2").Select
        Selection.Merge
        
End Sub


I want repeat the measurement of row 1 to 4 over and over until it get to row 450.

Once the rows are set merge cells A2:B2 and then E2:F2 move down 4 rows merge A6:B6 and then E6:F6 and repeat untl row 450.

Can someone show me how to repeat loop

Please see the attached file. I ave created button which user presses to setup sheet.

Help would be apricated.


Hello All,

I have been scouring the boards for a solution to my problem and I have found a similar problem and solution but it is does not work with my specific case/workbook.

I have a program created in XNA .net framework which will take an image and break it down into individual pixel RGB values and create a .csv file with the RGB in each cell for each pixel. I would like to cange the font colour and background of the cell to match the value in the cell. The values in each cell are written 0,0,0 > 255,255,255. The problem is similar to this post http://excel.bigresource.com/Track/excel-Y30kLP4F/ but i need to affect the cell containing the value, and the values are written in each cell instead or separated across 3 columns.

I want to recreate the image as a coloured data set with each cell representative of a pixel or an image, containing the RGB value and background colour or the code conatined in the cell...

Any ideas


Hello all,

I am not a novice to excel although it might seem like it with the question I am about to ask. Any input would be much appreciated.

I am trying to see if there is a quick way to do the following:

I have a price grid table spanning about 6 columns x 5 rows :
Along the column headers are different widths
Along the Row headers different lengths
Each cell in this table has a cost for a product that is X width by Y height.

I would like to be able to enter values for width and height in cells C5 and D5 and have the value for those measurements for those sizes be returned in cell B6.

Also, you'll notice that in the price table that I've created I have inserted intervals. Is there a way to do this so that I only have to include the upper values in the cells and still get the correct pricing?

Thanks in advance,

Erik


I have a single column which I list all the door sizes offered. Doors are listed by width and then height.

Example of Door Sizes Offered Column (info for clarity)
3068 (3'-0" x 6'-8")
3070 (3'-0" x 7'-0")
4040 (4'-0" x 4'-0")
4068 (4'-0" x 6'-8")
4070 (4'-0" x 7'-0")
5068 (5'-0" x 6'-8")
5070 (5'-0" x 7'-0")
*Actual List is about 300 sizes

User Inputs - Each their own cell
Width in Feet
Width in Inches
Height in Feet
Height in Inches

If Door Size input by user does not exist I want to select the next size door with equal or greater width and height. I was going to use next larger number but this does not always out door with larger height since second variable. Example client wants a 3868 the next largest number is a 4040 so found a good width but the height is a problem.

I was hoping to find a formula solution and stay away from a custom vba function. Any help would be great.

I can break out the width and height into their own column and place side by side if this helps.


Hello Everyone,

I am importing some text files into an excel worksheet. I want to change the format just a little bit. For each date I have 5 rows (pixel: 25, 37, 50, 100, and 200). When I import my data the date is in the same row as my pixel numbers. I want to place the date in another column to the left of these pixel numbers.

Below is an example of my "spreadsheet" The first 5 lines (with date "2008_308.txt" next to each pixel number is what I want it to look like and the next (with date "2008_309.txt" is how it is imported with only one date above the pixel numbers. I could do this manually, but I have many years of data to import. And would like a way to kind of copy/paste these multiple items at the same time. Any ideas?

Thanks,
Melissa


____________ Pixel Area(%) Cumm. Area Count Area (km^2)
2008_308.txt 25
2008_308.txt 37
2008_308.txt 50
2008_308.txt 100
2008_308.txt 200
____________ 2008_309.txt
____________ 25
____________ 37
____________ 50
____________ 100
____________ 200


Hi,

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.

Code:

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





Is it possible to do this:

Give me height values underneath the width values.

You guys have already helped me with getting the width values:
http://www.excelforum.com/excel-programming/607070-subtraction-macro-request.html

My definition of a height value:

For each region of blue cells, I want it's "highest peak value" minus the "first blue value" in it's region.

So for example.

0.5
0.55
0.6
1.8
0.6
0.59

so in like Column C, underneath the width value, I want the height value:
1.8 - 0.5 = 1.3

I'd like this for every blue region in all columns of a spreadsheet ranging from A:AZ, with rows going all the way to 2000.

Is this possible?

Thanks so much


Hello,


I'm having the following question about the row height and collumn width in Excel 2003.

Are these values in inches, milimeters or something else ?

I have a cel with a row height of 12,75 and a collumn width of 18,14.
When i look at the dimensions of the cel the width should be at least 3 times the height.

Are different units used for the height and width of a row or collumn ?
Which units are used and can they be changed somewhere ?
Maybe in the settings in Excel (2003 version) ?

Who can help me solve this little problem ?

Thanks.


Flash.


Hi,

I have made charts in VBA charts that needs to be placed on specific position and have specific sizes on a chartsheet. I use plotarea (top, left, width, height) for that. Unfortunately when I set these values they keep chaning, 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 new 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.
I am trying to find a solution now for 3 days and now I only dream of huge charts (which is not good). So please can someone help me with this? This is the last forum, that I can try, I didn't get reactions from others.

Code:

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





Hello all,

I'm trying to export charts directly from excel as gif or png. I've found a previous post (here) that gives a couple code snippets to do so, but I'm having trouble putting them together. This is what I've got in a module in my personal.xls:

Code:

'Code courtesy Stephen Bullen
'API's for getting the factors to convert points to pixels
Private Declare Function GetDC Lib "user32" ( _
                ByVal hwnd As Long) As Long

Private Declare Function GetDeviceCaps Lib "Gdi32" ( _
                ByVal hDC As Long, _
                ByVal nIndex As Long) As Long

Private Declare Function ReleaseDC Lib "user32" ( _
                ByVal hwnd As Long, _
                ByVal hDC As Long) As Long

Private Const LOGPIXELSX = 88
Private Const LOGPIXELSY = 90

'The width of a pixel in Excel's userform coordinates
Public Function PointsPerPixelX() As Double
    Dim hDC As Long

    hDC = GetDC(0)

    'A point is defined as 1/72 of an inch and LOGPIXELSX returns
    'the number of pixels per logical inch, so divide them to give
    'the width of a pixel in Excel's userform coordinates
    PointsPerPixelX = 72 / GetDeviceCaps(hDC, LOGPIXELSX)

    ReleaseDC 0, hDC

End Function

'The width of a pixel in Excel's userform coordinates
Public Function PointsPerPixelY() As Double
    Dim hDC As Long

    hDC = GetDC(0)

    'A point is defined as 1/72 of an inch and LOGPIXELSX returns
    'the number of pixels per logical inch, so divide them to give
    'the width of a pixel in Excel's userform coordinates
    PointsPerPixelY = 72 / GetDeviceCaps(hDC, LOGPIXELSY)

    ReleaseDC 0, hDC

End Function


Sub ExportChart2()

Dim DesiredPixels As Double

    DesiredPixels = 1000

    With ActiveChart.Parent
        .width = DesiredPixels * PointsPerPixelX
        .Height = DesiredPixels * PointsPerPixelY
    End With

    ActiveChart.Export ActiveWorkbook.Path & "\chartexport.gif", "GIF"

End Sub


However, it crashed on the lines in my macro, at .width = Desired... under With ActiveChart.Parent, saying the "object doesn't support the property or method." I don't really know what the functions from Stephen Bullen do, but obviously it's not liking something I'm doing. Any ideas?

Thanks!


I have several black rectangular shape objects with rounded corners on my 2007 sheet. I have each one sized as wide as the black colored cells they overlap (or so I think). I've zoomed in 400% to make sure they were lined up properly and they look great at 400%.

When I zoom out to 100%, every one of the rectangles are aligned left to each cell correctly, but they are all 1 pixel shorter and look to be 1 pixel short on the right side of the cell.

But then when I print the sheet, the rectangular shapes in the printout appear to be 1 pixel wider and hang off the right side of the cell by 1 pixel. The left side is still aligned correctly.

Does anyone know what is going on and how I could fix this?

I could just make them 1 pixel longer so it looks right when viewing at 100%, but then my printout will look like it is 2 pixels wider and hang off the right side of the cells by 2 pixels.


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.


The code below sets the range where i want the image to reside and correctly inserts the image to the range a1:f1 except the height. The image bottom edge is down at row 4 instead of the bottom of row 1 which i have set the pixel height before insertion.

Any idea how to set the height properly so it only covers the a1:f1 range?




Sub Test()
'***Change to suit
Const PicName As String = "X:\slksdffsldkfslhf .jpg"
Dim Pic As Object
Set Pic = ActiveSheet.Pictures.Insert(PicName)
ActiveSheet.Select
Rows("1:1").RowHeight = 69
Range("A1:F1").Select
Application.CutCopyMode = False
Selection.Merge True
With Pic
.Top = Range("A1").Top
.Left = Range("A1").Left
.Height = Range("A1").RowHeight 'need to fix this
.Width = Range("A1:F1").Width
End With
End Sub


I have just moved over to Excel 2007 (from 2003) and need help please.

When I manually adjust the column width, or row height, the very useful label showing the width value doesn't appear.

I've gone through the options but can't find where the control is for this function. Can someone please tell me how to turn this back on. I would like to know the width value without having to go to the Column Width... option.

Cheers, Richard.


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.


Hi,

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.

Thanks!

' 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