Altering Excel Font Rendering to Fit Content in Various Zoom Levels - excel

You can easily fit the content of your cells by selecting a series of columns and double clicking with your cursor between two cells. However, if you zoom in or out the rendering of the cells changes and what had been autofit changes relative to the size of the cell and you end up with a #####.
Is there a way to autofit cells that will hold irrespective of the level of zoom?
This is probably more question for the software development team at Excel but perhaps a VBA band-aid fix could be implemented in the interim, if the problem is ever addressed.
Thanks!

Unfortunately the zoom level (by scrolling with the mousewheel) by default cannot be captured to trigger a VBA script.
The only solution seems to be to have a VBA subroutine running in the background constantly that stores the current zoomlevels and the sheet they apply to in a Public variable.
When that variable is different from the one currently observed from the application you need to activate Autofit for all the worksheet columns again.
Alternatively you could just store a single number (THE zoomlevel), then when you switch between sheets that have different zoomlevels the subroutine will immediately Autofit for the sheet you switch to.
Ofcourse you have to consider the intervals at which this is done.
Last alternative is to Autfit manually whenever you spot such occurence...

There is a menu button who does that automatically. For me it is in the Ribbon "Start", than "Rows" , than "Format" than one of the Columnwidth options.
Excuse the vague description, I am using a german version of Iffce.

Related

What causes scrolling to be disabled in an excel worksheet?

I apologize because I feel like I am asking a silly question that I should know the answer to.
I'm wondering what I have done to make it so that one of my worksheets within a workbook does not allow me to scroll.
Some things that might be important
This worksheet contains command buttons. The command buttons are used to add rows to tables
One of the command buttons moves all the other command buttons to align them nicely
this worksheet contains tables
What I have tried and so no change
I tried duplicating the worksheet and deleting all the command buttons
In the duplicated worksheet I converted all tables to ranges
I made sure I didn't have frozen rows/columns
What I tried and maybe learned something?
I tried selecting all cells and pasting in another page, when I pasted with values I could scroll, when I pasted with sourse formatting I could not. This makes me think it is related to some formatting but I am not sure what specifically.
There're a list of items that could be going on...
Scroll lock could be on
You set .screenupdating=false
You are showing a userform that has mode
You have so much memory in use that Excel disabled its display, e.g., you can still debug.print in VBA, but the window doesn't scroll while in the instance (and you can save).
Those are some quick heavy hitters, but without having details about what is in your sheet (most of which probably can't be easily shared in a post), nothing can be said definitively.
As such, this is a subjective/speculative question as is and should be closed.

Excel-VBA Get Code of the design of existing cells

For an application of protocolling some measurements and therefore made a design for the print out of the data. This is a fairly complex design with many highlighted area, marked cells, font size changes, background color, pictures and so on.
My question is: Is there any way to get the design as a VBA code to "store" it without doing it all manually?
I already tried around some with the macro, though I couldn't "read" the current cell design.
Thank you in advance
You could save your empty templates on hidden sheets and copy the required on to the "print" sheet. Storing all of the formatting in code will be difficult to manage unless it's very basic formatting.

Groovy POI created cells considered blank by other programs until ENTER is manually pressed in cells

Ok this is kind of hard to explain.
I create a cell in my worksheet using JAVA POI
newCell= row.getCell(index)
if (containerCell == null) {
containerCell = row.createCell(index)
}
newCell.setCellType(HSSFCell.CELL_TYPE_STRING)
newCell.setCellValue(strVar)
If i then open the worksheet in EXCEL, I see that the cell value is indeed set. However if I load this into another external program that reads EXCEL sheets, it claims the cell I just set is blank.
NOW, if I go back into excel and do a simple "Hit return" on the cell in question, in the formula bar (even though its not a formula) and try to reload it into the external program, it works fine. Do I need to evaluate a formula on a string?
Thanks
I have no experience with Java, but having to hit enter in a cell is usually indicative of calculation being set to manual. Since you are working with API it may be treating your input from Java as a formula (?).
Open the offending workbook in its broken state, and on the sheet you are having problems with choose [Formulas] tab at top, then [Calculation]>Calculate Sheet.
If this updates the value then I see two options...
See if there is an option to manually calculate the sheet with POI, after the value has been entered.
Alternatively, you can write just a tiny bit of VBA to force calculation on that sheet when workbook is opened. MSDN offers a simple example.
http://msdn.microsoft.com/en-us/library/office/aa223802%28v=office.11%29.aspx
I have had to do this for Excel apps where calculation had to be set to manual to avoid excessive overhead. Just a guess though..
I am not sure why this was happening.. and evaluating the individual cells did not solve it however running evaluteAll() on the entire workbook made it work!

Address of first layer of precedent cells via VBA in Excel

On the debug toolbar, you can click a button that shows you directed arrows of cells that are directly called by the selected cell (I'm calling these direct precedents the 'first layer'). However, when you use the Precedents property on a cell, it returns all of the cells on the sheet that the cell is dependent upon.
For example, I have cell DT836 with the formula:
=DP836+DR836+DS836
"Trace Precedents" Debug toolbar shows a nice blue arrow connecting those three cells to cell DT836.
Range("DT836").Precedents contains a 70,000+ cell range with (as far as I can tell) no way to distinguish between how distant a dependent is from its precedent.
Is there a way to discern this using VBA?
It turns out there is a different property for ranges that tells you this, DirectPrecidents.
I had thought that it would be a property of the precedents, not a separate property in and of itself.
Alec,
Thank you for closing out your own question. I am posting these comments as an answer rather than a comment given their length
Excel is rather flakey when it comes to 3D functionality (across sheets). Both Precedents and DirectPrecedents work only on the local sheet
To work with off-sheet Precedents and Dependents you will need to use the NavigateArrows Method, this is the VBA equivalent of tracing precedents and dependents via the audit toolbar.
Bill Manville did the heavy lifting on this approach some time back, below are two links applying Bill's approach. The first provides Bill's function, the second link is from me, this article looks "backwards" to test if a certain number eventually links back to a specific sheet
Bill Manville's FindPrecedents function (written up at vbaexpress)
My article 'Using a recursive NavigateArrows Method to analyse all local and off sheet cell dependencies' at Ee

Making use of selected or clicked cell without VBA

A tricky one, I assume. However, is there a way to make use of a selected or clicked cell in Excel somehow without the need for VBA?
(I know how to do it with VBA, but macros are macros, but if you want to give workbooks to people...)
For instance, I would like to make some of the content in the freezed section to be dependent on where in the sheet someone is. It would be optimal, if the selected cell/row would be trigger enough.
It would be also okay, if clicking a cell (e.g. a link navigating in the sheet) would trigger the conent to change. Hence, a solution would be to make a hyperlink change a value in some cell somewhere. I know, this is a different question, but it should be all accomplishing the same goal of the line on top ;-)
Thanks a lot!
You cannot change values or display of another cell with formula or functions.
The hyperlink will send you to another location but won't change the freezed part, except if you only freeze rows and the hyperlink send you to a further column. But you will have then to really think about your layout very precisely. Moreover, the user will even less understand what happens unless you can design a great UI (but Excel may not be the best tool though).
Some tips:
Use hyperlinks but on differents sheets
Use "transparent" macros (without big buttons but rather event vba as you pointed out)
Sorry i don't have a magical solution.

Resources