Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!
Subscribe for Free Excel tips & more!

Find Pixel Coordinates Of A Cell

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

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.

View Answers     

Similar Excel Tutorials

Quickly Replace A Lot of Data in Excel
The Find & Replace works much the same way as Find and is located in the same place. (Find & Select drop do ...
How to Quickly Find Data Anywhere in Excel
Finding specific records and/or cells is easy when using the Find tool in Excel. It is located within the Find & ...
Quickly Find All Comments in a Spreadsheet in Excel
In Excel, you can create a comment for any cell in the worksheet. The problem is that these comments are hard to f ...
Get the First Word from a Cell in Excel
How to use a formula to get the first word from a cell in Excel. This works for a single cell and an entire list or ...
Determine if Cells Contain a Specific Value in Excel
Find if a cell or range of cells contains a specific value in Excel. This method can be used on individual cells wh ...
Get the Last Row using VBA in Excel
How to find the last row of data using a Macro/VBA in Excel, including getting the number of that row and any data ...

Helpful Excel Macros

Get Values from a Chart
- This macro will pull the values from a chart in excel and list those values on another spreadsheet. This will get the s
Create a Line Chart with a Macro in Excel
- Create a line chart in Excel with this macro. This allows you to quickly and easily create line charts and graphs from
Create a Column Chart with a Macro in Excel
- This macro adds a column chart to Excel. This is an easy to use macro that allows you to quickly chart and graph a rang
Delete All Chart Sheets in Excel - Only Chart Sheets are Deleted - Not Embedded Charts
- Delete all chart sheets and tabs in Excel using this macro. This will only delete the charts and graphs that are in the
Print all Embedded Charts in the Entire Workbook
- This macro will print every embedded chart in the active workbook. If you have an embedded chart in any worksheet within

Similar Topics

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 ?

I would like to plot 3D coordinates on a 2D surface graph. Each coordinate set would have its own 'Number' as referenced in Attached spreadsheet. This number should be used for the Legend in the chart. In the example there should be 9 3D coordinate points and thus 9 items in the Legend.

I have labelled the axes how they should be set out I just cant seem to get the graph to work the way I have described above.

The resultant for the graph would be a 2D surface between the coordinate points. Maybe I am using the wrong type of graph but any help would be appreciated in trying to get this to work.


I have three columns in my worksheet. They give x,y coordinate and radius of circles. I want to create circles at these coordinates with these radii. Overlapping is not a problem as that depends on my coordinate calculation. Can anyone please help me??

I am a beginner at excel programming....

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'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.

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.

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

My question is this. I have a table that has on the header row the name of a refrigerant and in column A it has a temperature. I need to find a way to do a lookup that will use the intersection between the header (column B) and where it intersects (Row 9) based on two inputs and give the data in the cell where they intersect just like an x-y coordinate. Is this possible and if so, how?

Thanks in advace

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

Okay, I've been beating my head against this for a while and haven't gotten very far.

What I need to produce is a chart where, for each subject, there is a timeline plotting their orientation date, the date of each session they completed and if there was either a "Stepped Care" or "Use" event. Basically it seems like a couple of series within a scatter chart, but I can't even get it started because I don't know how to have the chart pick up more than one series on a plot and have it look right.

I believe it should work because I can use the Subject ID as the Y coordinate and the Date (in days from orientation) as the X coordinate for each series item, but it just isn't coming out.

Here's where it gets hairy. Each subject will only have one orientation date but could have 40 sessions over 180 days.

I know I'm not describing the process as effectively as is necessary for a quick response, but I did include a spreadsheet with the raw data at least.

Basically, for a set of subjects there are several types of events that can happen. I need to create a chart listing all of these subjects and type and day of each of these events.

Thanks for any direction you can give. I'm a bit lost right now.

My first data point is supposed to be $0 on the X and -$2,500 on the Y axis. The Y coordinate plots fine. But instead of $0 being plotted on the X axis it is "indented slightly" and says "Point 1" when I do a mouse over the first data point.

How do I get the X coordinate to be $0, instead of being recognized as Point 1?

Do you think it could be possible to chart a "ternary diagram" with Excel (and without an additional tool) ?
You can find an example of such a diagram the

This is often used by chemist when they deal with a mix of three components.

I simply need to represent point on such a triangular diagram.
A point is represented by three numbers (x,y,z) but the three numbers sum up to 100%: x+y+z = 100% .
Therefore -of course- a point can simply be represented by two coordinates x an y, and the third coordinate can be calculated or can be read on the diagram.

Any suggestion?

I want to force a VBA-created form to open (show) at a fixed location on the worksheet. Specifically, I want it to lodge in the upper left corner so the top left corner of the form completely covers cell A1. I can set the form's Top and Left properties, but those two parameters vary according to screen resolution, toolbars showing, and zoom level.

Is there a way, programatically, to determine the pixel location of the top left corner of A1 (or any other cell) so they can be used to set the form's Top and Left properties prior to Form.Show? So far I haven't found a way to do that. Or is there some other way to position and anchor the form location to a specified worksheet cell?

Would appreciate any words of wisdom.

I have two Pie charts side by side and I am having a bit of difficulty getting them to be symetrically and was wondering if anyone had any idea why. Below is the code I use to set the size and position. As you can see Chart 1 & 2 have the exact same dimentions and Vertical Position. The only thing that is different is the Horizontal Position. the problem I have is that no matter what I put Left at on chart 2 it stays in the same place (about an 3 inchs to the right of the other chart - only want 2 inches of seperation)

Any ideas would be great.


'Chart 1
   With ActiveSheet.ChartObjects(1)
        .Top = 322.5
        .Left = 70
        .Width = 337.5
        .Height = 264
   End With
   With ActiveChart.PlotArea
        .Top = 322.5
        .Left = 175
        .Width = 337.5
        .Height = 264
    End With
'Chart 2
   With ActiveSheet.ChartObjects(2)
        .Top = 322.5
        .Left = 450
        .Width = 337.5
        .Height = 264
   End With
   With ActiveChart.PlotArea
        .Top = 322.5
        .Left = 175
        .Width = 337.5
        .Height = 264
    End With


I have made an iterative process in VBA, which gives the angle of a perfect circular circle between to points with North South coordinates(X) and East West coordinates(Y). The Depth is of no interest in this case, so there is no Z coordinate.

What I need is the solver to do is continue down i = i+1, meaning the constraints change down one cell as well as the target cell and the cell needed for change. In this case the target cell and the cell needed for change is the same.

The code is here and is written in excel2007, meaning the add-in for solver is written like "solver.xlam".

Private Sub CommandButton1_Click()
End Sub

Sub CheckCells()
Dim Data As Range
For Each Data In Range("A1:B20")
If IsEmpty(Data.Value) Then
ElseIf WorksheetFunction.IsText(Data.Value) Then
MsgBox "There is text written in the cells - remove!!!"
ElseIf WorksheetFunction.IsNumber(Data.Value) Then
End If
Next Data
End Sub

Sub SolverMacro()
Application.Run "solver.xlam!Solver.Solver2.Auto_open"
Application.Run "SolverReset"
Application.Run "SolverAdd", "E3", 1, "F3"
Application.Run "SolverOk", "G3", 1, "0", "G3"
Application.Run "SolverSolve", True
End Sub

This code in Solver says E3=F3 by changing G3 to achieve the angle and place it in G3. This happens when the commandbutton1_click is run, and the cell is not empty by initiating the CheckCells(), which again starts the SolverMacro() routine.

E3=(X-Xo)/(Y-Yo) ->where X is the new coordinate while Xo is the one before, and the same for Y and Yo. Xo is C2, X is C3, Yo is D2, Y is D3

F3 = (sinφ-sinφo)/ (cosφ-cosφo) -> where φ is the angle corrospondent with the coordinate of X and Y, and φo is corrospondent with the coordinates Xo and Yo. φo is the known cell G2 and φ is the iterative solution G3 of the angle for the circular arc between the two points.

So the solver changes G3 till E3=F3 and thus making it an iterative solution. How can I make the code so that it continues to calculate E4=F4 by changing G4. Have tried making an object and doing i = i+1, but I fail again and again. Maybe some of you have a solution? I could make a commandbutton for each row, but I have like 40 rows, so I would very much like to have only one commandbutton doing the CheckCell() and when there is a number inside the X and Y the SolverMacro() is initiated. Any suggestions??

Hope I am explaining well enough what I want? The way I see it is the SolverMacro() which need to be changed, with some i = i+1 and so forth.... Hope you could help me. I am really stuck here and it would simplify my workbook a lot!

Greetings from Norway

Haakon Martin

I am making an algebra test with questions that require my students to graph a linear equation. The test is in word, but I would like to insert (from Excel - since I gather it will be easier to create it in Excel then word) an xy coordinate graph. Any suggestions

(BTW - I am using Excel 2003, but if I must I can use Excel 2003)


Gene Klein

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.


I can't seem to find this anywhere for some reason but how do you name a chart. When I use the macro recorder I see they get named Chart 1, Chart 2 etc.
I have a macro to create a chart that works the first time around, but will create a new chart each time it is run. I want it to just update, but can't figure out how to get the name of the chart to reference it.


'Make Chart
Set d = .Find(Hours_Chart,  LookIn:???) 
         'If the chart hasn't been created, then create it. 
 If d Is Nothing Then 
           ActiveChart.ChartType = xlColumnClustered
           ActiveChart.ApplyLayout (5)
           ActiveWindow.SmallScroll Down:=0
           ActiveChart.SetSourceData Source:=Range(("O3"), Range _
            Need to name chart as "Hours_Chart" so that below I can refer to it. 
                 'Otherwise if it is present, then update it. 
            'Chart you are updating 
          ' Set range data 
               Set rngChartdata = Sheets("Hours Log").Range(("O3"), Range _
                   ActiveChart.SetSourceData Source:=rngChartdata, _
        End If

1) How do I give the chart a specific name?
2) How do I use .find to see if it is already there.
3)What property defines the charts location on the screen.

Thanks as usual...

If I can't search for it, but can name it I can just select it, delete it and re-make it.

I can't seem to figure out how to change the following in xl3DPieExploded Chart:

3-D Rotation: X = 0, Y = 30, Perspective = 15

I have the following:

With ActiveSheet.ChartObjects.Add(Left:=25, Width:=450, Top:=150, Height:=350)
.Chart.SetSourceData Source:=Sheets("LoanType").Range("A1").CurrentRegion
.Chart.ChartType = xl3DPieExploded
.Chart.Legend.Position = xlBottom
.Chart.ChartTitle.Text = "IRE By Loan Type"

End With


Selection.ShowCategoryName = True
Selection.ShowValue = False
Selection.ShowPercentage = True
Selection.Position = xlLabelPositionOutsideEnd

ActiveChart.Rotation = 30
ActiveChart.Perspective = 15

But when I look at the chart after this runs, I see:

3-D Rotation: X = 30, Y = 15, Perspective = 7.5

I've been searching for how to set these properly and can't seem to come up with any solutions. Any guidance would be appreciated.



I generate a large dataset of X- and Y-coordinates. Togeter, these datapoints form random curves. So, in excel, I want to calculate the Y-coordinate of the center of mass of these datapoints. Can anyone tell me the easiest way to do this?


Hello Excellers,

I have a spreadsheet where I want to export the charts using VBA, which I've been able to do using this:

Dim oCht As Chart
ActiveSheet.ChartObjects("Chart 3").Select
Set oCht = ActiveChart
On Error GoTo Err_Chart
oCht.Export Filename:="C:\Documents and Settings\All Users\Desktop\PopularICON.png", Filtername:="png"

If Err 0 Then
Debug.Print Err.Description
End If

However, due to the size of the chart, the export picture size is quite small and when enlarged to use in a document becomes blurry. I know that a way round it is to manually make the chart bigger but then I have to change all the font sizes and sizes of the points etc, which I don't want to do because there are quite a few charts.

Is there something I can add to the macro to export a chart as a larger picture?

Possiblely stop screen updating and then resize the pictures, export, the resize them back to the original size, and enable screen updating?

So I created a pivot table with a bunch of data I have and I also have a scatterplot that I would like to coordinate with it (ie every time I add a field, the data will appear in the scatter plots and if I want to remove a point from the chart, I can simply uncheck from the pivot table. Here's my problem: when I add or remove data from the pivot table all the other existing data moves to new cells and and chart is thrown off. What's my best solution? (i hope this all makes sense..)


I've written some code to programmatically change the chart title and chart
title font size based on user interaction.

Problem is that each time the title undergoes a smaller font size change,
the chart actually changes position within the chart area by moving up.

Also any labels i've placed in the chart area also changes position and move
up as well.

Anyone have any ideas why and how to stop this?

Thank for helping!

Hi All,

I have the below macro which loops through all sheets in a workbook and resizes the charts in the each sheet as per the size entered by user but It doesn't show a msgbox with text "that it didn't find any chart on a particular sheet". I want to put some code that it will show that it didn't find the charts in which all sheets at last the macro run gets completed.

Code to resize charts in multiple sheets:

Sub ResizeAndArrangeChartObjects()
Dim W as Long, H as Long, TopPos as Long, ws as Worksheet
W = InputBox("Enter chart width", "Set Chart Width", 100)
H = InputBox("Enter chart height", "Set Chart Height", 75)
TopPos = 0
For Each ws in ThisWorkbook.Worksheets
    For Each chtObj In ws.ChartObjects
        With chtObj
            .Width = W
            .Height = H
            .Left = 0
            .Top = TopPos
        End With
        TopPos = TopPos + H
    Next chtObj
Next ws
End Sub

Code to resize charts in activesheet:

Sub ResizeAndArrangeChartObjects()
W = ActiveSheet.ChartObjects("Chart 1").Width
H = ActiveSheet.ChartObjects("Chart 1").Height
TopPos = 0
For Each chtObj In ActiveSheet.ChartObjects
     With chtObj
             .Width = W
             .Height = H
             .Left = 0
             .Top = TopPos
     End With
     TopPos = TopPos + H
Next chtObj
End Sub

I got the below codes so far to check the existence of charts on the activesheet sheet but I am not sure how to incorporate the same in the above macros.


Sub test()
Dim i As Long
Dim s As String
Dim ws As Worksheet

Set ws = ActiveSheet

For i = 1 To ws.ChartObjects.Count
s = s & ws.ChartObjects(i).Name & vbCr

If Len(s) = 0 Then s = "No Charts on " & ws.Name

MsgBox s
End Sub


Sub ResizeChartsonActiveSht()
With ActiveSheet
      If .ChartObjects.Count <> 0 Then
      Dim W As Long, H As Long
      W = InputBox("Enter chart width", "Set Chart Width", 100)
      H = InputBox("Enter chart height", "Set Chart Height", 75)

For Each chtObj In ActiveSheet.ChartObjects
     With chtObj
     .Width = W
     .Height = H
     End With
Next chtObj
MsgBox "No Charts Found on the ActiveSheet"
End If
End With
End Sub

Thanks a lot for your help in advance.

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.