Brian asked if there is a way in Excel to magnify the contents of the current cell. He's working on a worksheet which needs to be at a low zoom setting (30% or so) to see the whole sheet. As different scenarios are run, cells change color depending on the result. Brian can easily see which cells he needs to investigate, but he can't read them because of the zoom setting. He normally changes the zoom, reads the answer, and zooms back out to run another scenario. It would be much easier if only the current cell (the one selected) were magnified to a readable level.
There is no built-in method in Excel to accomplish this selective method of zooming, but there are a couple of workarounds you can use. One such workaround is to use a macro that displays the value in the active cell in a message box. Such a macro is easy to add to the worksheet module:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) MsgBox ActiveCell.Address & ": " & ActiveCell.Value End Sub
Every time you select a different cell in the worksheet, the macro pops up a message box that shows the contents of that cell. This solves the problem, but it can get tiresome to continually close message boxes every time you change which cell is selected.
You could also create a macro that simply changed the font size of whatever cell is currently selected. The following simple macro, added to the worksheet module, looks at the currently selected cell and increases its font size by 500%.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) FontSize = ActiveCell.Font.Size LargeSize = FontSize * 5 Cells.Font.Size = FontSize ActiveCell.Font.Size = LargeSize End Sub
The utility of such a macro will depend, of course, on how you have the height and width of the selected cell formatted. If they are static heights and widths, it is possible that increasing the font size will make the cell contents unreadable. If the height and width are dynamic, then the contents should still be quite readable.
Still another approach is to create your own zoomed-in picture of each cell as it is selected:
Private Sub ZoomCell(ZoomIn As Single) Dim s As Range Set s = Selection 'Get rid of any existing zoom pictures For Each p In ActiveSheet.Pictures If p.Name = "ZoomCell" Then p.Delete Exit For End If Next 'Create a zoom picture s.CopyPicture Appearance:=xlScreen, _ Format:=xlPicture ActiveSheet.Pictures.Paste.Select With Selection .Name = "ZoomCell" With .ShapeRange .ScaleWidth ZoomIn, msoFalse, _ msoScaleFromTopLeft .ScaleHeight ZoomIn, msoFalse, _ msoScaleFromTopLeft With .Fill .ForeColor.SchemeColor = 9 .Visible = msoTrue .Solid End With End With End With s.Select Set s = Nothing End Sub
In order to use the macro, you need to call it each time the selection in the worksheet changes. To do this, you add a small macro to the worksheet module:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) ZoomCell 6 End Sub
In this case, every time the cell selection is changed, the ZoomCell macro is run to create a picture that is six times the size of the original. If it gets bothersome to have the picture automatically change every time you select a different cell, you could do away with the trigger macro in the worksheet module and modify the ZoomCell macro so that it runs whenever you initiate it, perhaps with a shortcut key that you set up.
Sub ZoomCell() Dim s As Range Dim ZoomIn As Single Set s = Selection ZoomIn = 6 'Get rid of any existing zoom pictures For Each p In ActiveSheet.Pictures If p.Name = "ZoomCell" Then p.Delete Exit For End If Next 'Create a zoom picture s.CopyPicture Appearance:=xlScreen, _ Format:=xlPicture ActiveSheet.Pictures.Paste.Select With Selection .Name = "ZoomCell" With .ShapeRange .ScaleWidth ZoomIn, msoFalse, _ msoScaleFromTopLeft .ScaleHeight ZoomIn, msoFalse, _ msoScaleFromTopLeft With .Fill .ForeColor.SchemeColor = 9 .Visible = msoTrue .Solid End With End With End With s.Select Set s = Nothing End Sub
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10426) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Magnifying Only the Current Cell.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Need to get rid of extraneous spaces before or after the text in a string? VBA provides three different functions you can ...
Discover MoreA common part of working with text strings in a worksheet is normalizing those strings so that they follow whatever rules ...
Discover MoreHaving problems with using macros in a protected workbook? There could be any number of causes (and solutions) as ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2015-10-30 05:45:30
Barry
Another possible way is to use a TextBox.
Insert a TextBox and size it to suit the users needs, with the TextBox selected, type into the formula bar the address of the cell to be magnified preceded by an "=" (e.g. =D12). The font size of the TextBox can now be adjusted to a readable size.
This as it stands there isn't much different than just increasing the font size for the results cell, but it doesn't require that the whole row and column are made big enough to show the result without seeing "#########".
If the TextBox gets in the way a very short macro can toggle the Visible property to hide/unhide the TextBox.
NB a TextBox can only hold a very simple formula i.e. a single reference to a cell or a Named range (in which case only the first cell in the range is displayed in the TextBox.
2015-10-29 12:49:33
Have you got "Magnifying Only the Current Cell" VBA for Excel 2013
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2018 Sharon Parq Associates, Inc.
Comments