I am working on a technique that appears to exploit either an intended or unintended feature of Excel. Specifically, I have found that I can enlarge the width of a dropdown validation list in a narrow column without first enlarging its associated column. This exploits an odd habit that Excel has of saving the width of the last activated cell with such validation on that sheet when the workbook is saved.
As a result, I want to activate a wider cell (with a dropdown validation list) when the file is saved, but I do not want to leave that cell activated (and potentially wider than normal) when the workbook is not closed.
For example,
Is there a way to do this? Is there a way to detect that the save was not associated with a close event or some event that is triggered after a save if the workbook is still open?
Not sure I have even partially explained what I need, but I hope someone can interpret this and help.
Basically, I want to do some things when the worksheet is saved and closed and then undo some of that when the worksheet is reopened. If the save is not followed by a close, I want to do the same things and then undo them as if the worksheet has been reopened. In other words, if there was an easy way to force the sheet to always close and then reopen when "Save" is invoked, it would be messy (since I would likely have to store the last activated cell somewhere) but would probably work.
I guess I am looking for a way to test if the close is not going to happen or that the save has occurred but the spreadsheet has not been closed so that I can invoke a routine to undo the changes made prior to the save (probably with screen updating off so that the user doesn't see all the gyrations).
Thanks for any suggestions. I am sure that once I figure this out, I will realize how trivial it is, but I have no clue right now and cannot think of any straightforward method.
As a result, I want to activate a wider cell (with a dropdown validation list) when the file is saved, but I do not want to leave that cell activated (and potentially wider than normal) when the workbook is not closed.
For example,
- If the workbook is closed and saved, I want to activate a cell and possibly increase the width of its column and then save the spreadsheet. I will reset the size again in the open event and return to some default cell.
- If the workbook is closed but not saved, I want to do nothing.
- If the workbook is saved but not closed, I want to save the location of the currently active cell, activate a different cell and possibly increase the width of its column before the save but then reset the size again and then reactivate the originally active cell since I want to not disrupt the use of the sheet.
Is there a way to do this? Is there a way to detect that the save was not associated with a close event or some event that is triggered after a save if the workbook is still open?
Not sure I have even partially explained what I need, but I hope someone can interpret this and help.
Basically, I want to do some things when the worksheet is saved and closed and then undo some of that when the worksheet is reopened. If the save is not followed by a close, I want to do the same things and then undo them as if the worksheet has been reopened. In other words, if there was an easy way to force the sheet to always close and then reopen when "Save" is invoked, it would be messy (since I would likely have to store the last activated cell somewhere) but would probably work.
I guess I am looking for a way to test if the close is not going to happen or that the save has occurred but the spreadsheet has not been closed so that I can invoke a routine to undo the changes made prior to the save (probably with screen updating off so that the user doesn't see all the gyrations).
Thanks for any suggestions. I am sure that once I figure this out, I will realize how trivial it is, but I have no clue right now and cannot think of any straightforward method.