Find Pixel Coordinates Of A Cell 
New Excel Help Service!
We need your input to help create a new Live Online Excel Help service.
Please take our survey and let us know your thoughts!
Have a great day!
Don


Find Pixel Coordinates Of A Cell  Excel 
View Answers 
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.
Thanks a million.
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 ...
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 & ...
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 ...
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 ...
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 ...
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 ...
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
 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 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
 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
 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
 This macro will print every embedded chart in the active workbook. If you have an embedded chart in any worksheet within
Similar Topics
Hi,
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 ?
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.
Cheers.
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.
Cheers.
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....
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 http://www.excelforum.com/showthread.php?t=530800. But it was not answered
rgds
johnjohns
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 http://www.excelforum.com/showthread.php?t=530800. But it was not answered
rgds
johnjohns
Hi,
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 8bit greyscale.
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 8bit 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 xy coordinate. Is this possible and if so, how?
Thanks in advace
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.
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.
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?
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
http://www.geokem.com/images/scans/A...y_Mg_Al_Ca.gif
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?
You can find an example of such a diagram the
http://www.geokem.com/images/scans/A...y_Mg_Al_Ca.gif
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 VBAcreated 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.
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.
Code:
Any ideas would be great.
Code:
'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
Hi!
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 addin for solver is written like "solver.xlam".
[code]
Private Sub CommandButton1_Click()
SolverMacro
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
SolverMacro
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
[\code]
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=(XXo)/(YYo) >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 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 addin for solver is written like "solver.xlam".
[code]
Private Sub CommandButton1_Click()
SolverMacro
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
SolverMacro
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
[\code]
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=(XXo)/(YYo) >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)
Thanks,
Gene Klein
(BTW  I am using Excel 2003, but if I must I can use Excel 2003)
Thanks,
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?
https://webmail1.uwindsor.ca/~budihar/autoshape.html
Thank you very much. Any answer will be very appreciated.
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?
https://webmail1.uwindsor.ca/~budihar/autoshape.html
Thank you very much. Any answer will be very appreciated.
Hello,
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.
Code:
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 remake it.
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.
Code:
'Make Chart Set d = .Find(Hours_Chart, LookIn:???) 'If the chart hasn't been created, then create it. If d Is Nothing Then ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlColumnClustered ActiveChart.ApplyLayout (5) ActiveWindow.SmallScroll Down:=0 ActiveChart.SetSourceData Source:=Range(("O3"), Range _ ("P3").End(xlDown)) Need to name chart as "Hours_Chart" so that below I can refer to it. 'Otherwise if it is present, then update it. Else: 'Chart you are updating ActiveSheet.ChartObjects("Hours_Chart").Activate ' Set range data Set rngChartdata = Sheets("Hours Log").Range(("O3"), Range _ ("P3").End(xlDown)) ActiveChart.SetSourceData Source:=rngChartdata, _ PlotBy:=xlColumns 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 remake it.
I can't seem to figure out how to change the following in xl3DPieExploded Chart:
3D 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
ActiveSheet.ChartObjects.Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
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:
3D 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.
Joe
3D 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
ActiveSheet.ChartObjects.Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
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:
3D 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.
Joe
Hi,
I generate a large dataset of X and Ycoordinates. Togeter, these datapoints form random curves. So, in excel, I want to calculate the Ycoordinate of the center of mass of these datapoints. Can anyone tell me the easiest way to do this?
Thanks!
I generate a large dataset of X and Ycoordinates. Togeter, these datapoints form random curves. So, in excel, I want to calculate the Ycoordinate of the center of mass of these datapoints. Can anyone tell me the easiest way to do this?
Thanks!
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"
Err_Chart:
If Err 0 Then
Debug.Print Err.Description
Err.Clear
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?
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"
Err_Chart:
If Err 0 Then
Debug.Print Err.Description
Err.Clear
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..)
Hello,
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!
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:
Code:
Code to resize charts in activesheet:
Code:
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.
Code:
Code:
Thanks a lot for your help in advance.
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:
Code:
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:
Code:
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.
Code:
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 Next If Len(s) = 0 Then s = "No Charts on " & ws.Name MsgBox s End Sub
Code:
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 Else 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.
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.