Email:      Pass:    Pass?
Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!

Subscribe for Free Excel tips & more!

Free Excel Forum

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 ...
Find the Next Blank Row with VBA Macros in Excel
Learn how to find the next empty cell in a range in Excel using VBA and Macros.  This method will skip any blanks ...

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

I'm trying to return values of xy coordinates off of a particular data point from a series in a chart . My goal is to add a single line, based on a xy coordinate (pixel coordinate is what I believe I need) to a large number of charts. My difficulty lies in obtaining the xy coordinates, rather I believe all I really need is the x coordinate. I've been trying to use the ValueToPoint() function, but I can't seem to get it to work. The MSDN forum doesn't provide too much information, rather I can't find the file they're referencing in their example, so I can't trace to see how the code is supposedly to actually work. (The link to their help section is he The other code is not a problem of compiling, but I'm just missing the coordinate to reference where to start drawing. Any help would be greatly appreciated. Thanks.

Is there a way to capture the data from a DOS like screen (3rd party
software) without connecting to the database. May be using the coordinate
system / copying data to clip board and searching for specific string ect.?

The screen size and pixel / resolution will be consistent for all users.
The data will always be dispayed on a specific coordinate on the screen all
the time. The filed lengths are fixed as well.

Any help is appreciated.


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.


I have a XY-scatter(with lines) chart where I even want to show the coordinates for each point in the chart. I manage to show either the x-coordinate or the y-coordinate but not both at the same time.
Hope someone can help me!!

I have two paired sets of XY (Cartesian coordinate) data. I need to correlate coordinate set Xa n Ya n with coordinate set Xb n Yb n from 1 to N. Formulaaaa suggestions or references?


I am wondering if there is a way of getting the x and y coordinates (in relation to x and y data) from wherever the mouse is clicked on a chart. I am not meaning x and y screen pixel coordinates, i need x, y coordinates for chart data.
For example lets say you have dollars on y axis, and product on x. If you click the mouse on the chart it would spit out the product number and dollars (from x and y coordinates on the chart) for the position of the mouse pointer.

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 ?

Say I have a list of XY coordinates, each in their own column. What I need to do is somehow mark each coordinate as falling into one of 3 categories, perhaps by some formula in another column:
- there is another XY coordinate that is EXACTLY 1 unit away in either the X OR Y direction
- there is another XY coordinate that is EXACTLY 50 unit away in either the X OR Y direction
- there is another XY coordinate that is EXACTLY 500 unit away in either the X OR Y direction
- other

0,0 (1 unit away)
0,0.1 (other)
0.1,0 (other)
1,1 (1 unit away)
2,2 (1 unit away)
3,3 (1 unit away)
100,100 (50 unit away)
100,150 (50 unit away)
150,100 (50 unit away)
500,500 (500 unit away)
500,1000 (500 unit away)
1000,1000 (500 unit away)

My list would not be ordered in any way.

(0,0) is not categorized as "other" due to the presence of (1,1). The "other" category is only used if there is no other coordinate that can be used to categorize.

What is the quickest way to do this? I may have more categories to add, but they would just be more if the same, only at different distances.

Also, is it possible to choose whether to use the "larger" (or "smaller") of the categories? For example, say we have these three coordinates.

0,50 (50 away)
150,50 (100 away)

But (50,50) could be either (50 away) or (100 away). I wouldn't consider any other categories except the two "nearest" categories; e.g. if there was one that fit (200 away), it wouldn't matter since there is one that fits (100 away).

I hope I explained my problem well enough!

My thanks to anyone who bothered to read this!

I created a program that works in Excel 2007 and 2010, but there is one sub that I cannot get to work in 2013 which does the following:

When there is a picture on the sheet (top left at cell AA1)
Set the cursor position onto a specific pixel location
Get cursor position
Get pixel color at that position
Set the fill color of the cell behind that position to the pixel color

I am wondering if there are any functions that I used that work differently in Excel 2013 compared to 2010 and 2007 because when I run the sub, every cell is turned to white (when obviously the image I am using is not just white). It would be a huge help if someone could identify what is causing the problem! Here is the code for that sub:

Please Login or Register  to view this content.

Hello VBA'liens,
I want to create a chart with 3 lines, whereas the 1st has it's y-coordinate
in column A and its x-coordinate in column B, the 2nd line has its y-coordinate in column C and its X-coordinate in column E, the 3rd line has its y-coordinate in column D and its X-coordinate also in column E.
Line 1 has 30 coordinates, Line 2 and 3 have 10 coordinates.
this is my code!


Sub Makro6()
ActiveChart.ChartType = xlLineMarkers
' y-coordinates of line 1 in column A 
ActiveChart.SetSourceData Source:=Sheets("Sheet").Range("A1:A30"), _
' X-coordinates of line 1 in column B 
ActiveChart.SeriesCollection(1).XValues = "=Sheet!R1C2:R30C2"
' X-coordinates of line 2 in column E
ActiveChart.SeriesCollection(2).XValues = "=Sheet!R1C5:R10C5"
'y-coordinates of line 2 in column C 
ActiveChart.SeriesCollection(2).Values = "=Sheet!R1C3:R10C3"
'X-coordinates of line 3 in column E
ActiveChart.SeriesCollection(3).XValues = "=Sheet1!R1C5:R10C5"
'y-coordinates of line 3 in column D
ActiveChart.SeriesCollection(3).Values = "=Sheet1!R1C4:R10C4"
ActiveChart.Location Whe =xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasAxis(xlCategory, xlPrimary) = False
.HasAxis(xlValue, xlPrimary) = True
End With
ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
ActiveChart.HasDataTable = False
End Sub

I hope you understood my problem, excuse my bad English.
Hopefully someone knows the answer...

Best regards,


Im relatively new to VBA and as part of my final year project in college I have to create animations of mechanisms in excel for educational purposes. How does the coordinate system work when inserting a shape, I cant find any information on it? I know a A screen position has an X and a Y coordinate, with X increasing to the right and Y increasing downward. The origin (0,0) is the top left corner of the worksheet. how does that relate to top and left in code in VBA?




Im relatively new to VBA and as part of my final year project in college I have to create animations of mechanisms in excel for educational purposes. How does the coordinate system work when inserting a shape, I cant find any information on it? I know a A screen position has an X and a Y coordinate, with X increasing to the right and Y increasing downward. The origin (0,0) is the top left corner of the worksheet. how does that relate to top and left in code in VBA?



Hi. I have many (200+) charts, generated by a frequently updated Excel 2007 workbook, that I need to use in a website. The charts must be 500 pixels wide by 300 pixels tall. XL confirms these pixel dimensions, along with an absolute size of 5.2 inches by 3.1 inches (corresponding to a resolution of 96 DPI).

If I copy and paste one of these charts into another application as a PNG or BMP, the 500 x 300 pixel dimensions are maintained. So far, so good.

BUT, if I copy and paste the same chart as a GIF, it's 780 pixels wide by 470 pixels tall---far too big for my webpage. And, more significantly, I get the same (excessive) chart size if I save the entire workbook as a web page---the only practical option with 200+ frequently updated charts.

Windows reports the resolution of these bloated charts as 149 DPI. So, XL 2007 seems to be trying to maintain the original size of the charts in inches (5.2 x 3.1), rather than in pixels---but with a target resolution of 149 DPI.

The XL web options settings "screen size", "resolution", and "allow PNG as a graphics format" have no discernible effect on the chart size or resolution.

How can I get XL 2007 to maintain the original pixel dimensions during a "save as web page" operation, like previous versions? Alternatively, how can I force XL to use a desired resolution (e.g. 72 or 96 DPI instead of the mystery 149 DPI) for exported charts? Thanks in advance!

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 a range of cells with data in each cell. The range is from C3 to S23. The data is coordinates to cells on another sheet. I need to create a macro that will go to the range, pick out the first coordinate, execute a function, then go back and select the next coordinate, execute a function and so on through all 357 coordinates. Can anyone show me a small macro that will do that? Something like:

Range(C3, C4, C5, C6... S23)
Pick first coordinate,
Excute function at coordinate
Go back to range and pick next coordinate
Excute function at coordinate...
At end of Range, exit sub

I have the execute portion of the macro down.

Thanks in advance,

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

Hi fellows,

I need to solve this problem:
I have got two sets of independent data (700 and 300 registers each).
Register data type is
column A----- X1 coordinate column E----- X2 coordinate
column B------Y1 coordinate column F----- Y2 coordinate
column C------Z1 coordinate column G----- Z2 coordinate

Basically I want to compare each X, Y values from dataset one with each X, Y values from dataset two,
and for that I must use euclidean distance criteria

if sqrt((X1 - X2)^2 + (Y1-Y2)^2)< 0.1 (for example)

If the conditon is met, I need to write the avarages to new columns
(X1+X2)/2------column I
(Y1+Y2)/2 -----column J

and calculate abs(Z1-Z2) -----column K

This will return crossing points and the high difference between sets


Hi all, I'm Javier from Spain. Have been checking this forum for some time and it has been very helpful

What I'm trying to do is to make a chart clickable so that when you click on the date axis it will zoom to that date. The clicked date should then be the minimum value of the graph.

I have tried lots of things but have been completely unable to get the point the user has clicked on. I can get the mouse x coordinate but cannot find a way to translate it to the point coordinate.

Could you please give me some hint to do that? I could either translate the coordinates or if you can think of any other way please tell me so

Thanks a lot!

I am not a programmer, but am quickly realizing how amazingly helpful developing the skills of one can be. For now, however, I have a problem that I personally lack to the know-how to solve, and I'm hoping someone here will be able to figure this out for me.

My goal is somewhat difficult to describe, but I will try. Essentially, I have an image which i have reduced to a mathematical representation of light intensities. We can consider each cell in my spreadsheet as a pixel, the value within the cell corresponding to how much light that pixel it took in during an exposure. There is a trend along the pixels that i would like to isolate as exactly as possible: a diagonal line, not quite straight from the bottom left corner to the top right.

What I would like to do, if possible, is to treat each cell in my spreadsheet as a point on a coordinate plane, and to use some type of formula or macro to give me a line of best fit using the positions of the highest valued cells as the data points in my extrapolation.

The tool I'm looking for would take data organized like this:

1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 200 1 1 1
1 1 1 1 1 1 200 1 1 1 1
1 1 1 1 1 200 1 1 1 1 1
1 1 1 1 200 1 1 1 1 1 1
1 1 1 200 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1

And give me an equation of the form y=1x + b (describing where to find the maximum values among the cells), although my actually data will need to be fit to a higher order polynomial.

Once I can do this, I will also need a way to take perpendicular sums automatically along the line of best fit at distance of two pixels in both directions and a width of one pixel. You can imagine drawing a rectangular box perpendicular to the line of maximum values and adding the proportions of each cell enclosed by that box. This means that for the example above, i would get 209 for all five points of interest: the maximum value plus the two values of one in the upper left perpendicular direction, the two values of one in the lower right perpendicular direction, half the values of the two cells neighboring the exactly perpendicular cells and a quarter of the outermost cells touched by our imaginary pixel box.

The following image may be helpful in clarifying what I'm looking for. The red bar represents the imaginary box containing perpendicular pixel sums, where the green beam is the line of best fit derived from my maximum values. Attachment 337419

Also, here is a snippet of my actual data to experiment with in solving these strange and exotic problems Attachment 337420

I hope this wasn't all terribly confusing. Please let me know if anything in particular needs to be expanded on.

Thank you very much.

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.

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


Currently I am positioning a chart created with a vba macro by using


    With ActiveSheet.ChartObjects.Add _
            (Left:=325, Width:=750, Top:=600, Height:=300)

I would like to set the Top property with a cell. Is that possible? So instead of 600px I would like it to start at row 46 or whatever. I have multiple sets of data on a worksheet that need to be graphed. I would like to be able to position the graph by row instead of having to figure out where to start by pixel.

here is my problem.
i have set of 10 coordinates which make certain curve.
Now my task is for any given (x,y) dot to find distance from that curve (x coordinate,and y coordinate),so how far is that dot verticaly from curve

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?


____________ 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


Where is my error

Sub Open_hypersnap_Small()
   Dim shellstring As String
   Dim x1, Y1, W1, H1 As Integer
   Dim Coordinate As RANGE
   x1 = Application.WorksheetFunction.VLookup(RANGE("Graphnumber").Value,  RANGE("Coordinate"),  4, 0)

Coordinate is a range defined in my sheet

Mousse over Range("Coordinate") give "Nothing" message