Hi,
I guess the question is as is in the title. Is there any VBA Code where I can click a cell or area on the worksheet and Excel will zoom to that area?
Regards,
David
Hi,
I guess the question is as is in the title. Is there any VBA Code where I can click a cell or area on the worksheet and Excel will zoom to that area?
Regards,
David
Hello kinseldd5,
Excel automatically "takes" you to the area where you click. Do you actually mean to have the area where you "Clicked" to be enlarged - (Zoom larger)? If so, how Large would you like the area which has been Clicked, to show?
Please consider:
Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
Winon,
Thanks for the reply. I basically want to be able to click a cell, or more importantly a chart object which when clicked (or double clicked) will, lets say for example, be zoomed to full screen. I have seen this done before but can't remember unfortunately the method put forward. Do you have any suggestions?
Thanks.
if you don't need to be able to select the chart for anything else you can assign this macro to it
![]()
Sub Chart_Zoom() Dim rCurrSel As Range Set rCurrSel = Selection Application.ScreenUpdating = False With ActiveSheet.Shapes(Application.Caller) Application.Goto Range(.TopLeftCell, .BottomRightCell), True End With ActiveWindow.Zoom = True rCurrSel.Select Application.ScreenUpdating = True End Sub
Josie
if at first you don't succeed try doing it the way your wife told you to
@ JosephP,
Hi JP,
Thank you for helping.
I am quite happy with that!![]()
JosephP,
Thanks for the reply.
Unfortunately I do need to click the graph to get information regarding what values the lines correspond to and the axes. Would there be a method available that would only increase the chart size if double clicked and double clicking again would return to the original zoom?
Winon I appreciate your help too
Regards,
David
Hello kinseldd5,
Ajusting Chart sizes, increasing or decreasing, can most of the time play havoc with the Chart objects, i.e.; Font size and so on, pulling everything on the Chart askew. You can add two Buttons to the Sheet, one Button to increase the Chart to pre-defined parameters, and the other Button to decrease it to a set minimum size. (Then maybe a third Button to "Reset").
Since I am not exactly sure as to how your Chart is set up, and what Code you have running along with it, I am afraid, I might not be able to give you a ready solution.
There is however this one of many other sites where this topic is discussed in full length, offering many different ways of how to approach your specific requirement.
See this link: http://peltiertech.com/Excel/Charts/...tCreation.html
Hope that helps!
If you have any other issues, or if you are still stuck, feel free to let us know.![]()
Winon,
Thanks for the reply. I looked through the link you sent and unfortunately it's not exactly what I am looking for. I did however find the below code:
I unfortunately do not understand the code and as a result am finding it difficult to implement into my workbook. Do you have any suggestions or do you understand the method in place. I really appreciate your help. Thanks a bunch.![]()
Option Explicit Dim objChartClass() As clsChart Sub SetChartObjects(wks As Worksheet) Dim intChartCount As Integer Dim cht As ChartObject intChartCount = 0 For Each cht In wks.ChartObjects ReDim Preserve objChartClass(intChartCount) Set objChartClass(intChartCount) = New clsChart Set objChartClass(intChartCount).objChart = cht.Chart intChartCount = intChartCount + 1 Next cht Set cht = Nothing End Sub
Regards,
David
Hello kinseldd5,
In post No.3 you state:I checked the WorkBook you have uploaded, and my golly, it works! One click on a Chart and it Zooms in, Click again and it is restored to its original size! is that not what you wanted?I basically want to be able to click a cell, or more importantly a chart object which when clicked (or double clicked) will, lets say for example, be zoomed to full screen.
What else do you need to do?
Winon,
I wanted to see if you noticed an issue with the coding because when I add it to my workbook it does work, as in a click a graph and it enlarges to full screen, click again and it minimises, but then I receive an error report and Excel crashesNot sure why and thought yo might be able to shed some light.
I am sorry, probably should have mentioned this in my previous post.
Regards,
David
Hello kinseldd5,
No sweat. For what it might be worth, I have saved it as an xlsm WorkBook in Excel 2007. I see that you are using Excel 2010, and there could be some issues there. I don't know, but please check it in this format and see if it now works on your side as well. I have no problems in xls or xlsm formats.
Please let me know how it goes.
Last edited by Winon; 10-01-2012 at 01:36 PM. Reason: Spelling - (I am Afrikaans)
Winon,
I do not know where you got the information from but I only have Excel 2007 installed on my computer so its odd that you say that? However I understand it may work on your computer but the workbook I am using that set of code in (which is filled with 100's of lines of macro code (and for work reasons I am not allowed to upload)) seems to crash when I use the chart zooming. It may just be down to the shear amount of data in the workbook and unfortunately an error code is not issued therefore I cannot reference the issue online.
I understand having the workbook available to you you would probably sort it out very quickly but sadly I am not in a position to do so
Regards,
David
Hello David,
That is what is showing as your "MS-Off Ver" under your name "Excel 2010". Then maybe you should change that to Excel 2007.I see that you are using Excel 2010
Sometimes setting EnableEvents to false and/or setting Calculation to manual, all at the beginning of your Code Procedures, and then restoring it at the end, solves most of lurking problems.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks