Ensuring DatePicker is available in VBA - excel

I have a question to which I couldn't really find an answer for with a Google Search. I'm working on a VBA assignment, one of the sections requires the user to enter a start and end date which will be used to filter through a set of data. I have been using the DatePicker package and it has been working fine. I then emailed my assignment (to myself) to work on later on, and noticed that the DatePickers don't show up on the forms. When I open my assignment, an error message pops up saying "Could not load some objects because they are not available on this machine". Now, the Date Pickers are already installed on the computer I am using, but they have to be added through the menus in excel.
Anyway, I was just wondering if there is anyway I can ensure that the date pickers will be available with the Excel file that I eventually submit. Otherwise, I will have to input the dates through another mechanism (which is fine, but the Date Pickers provide a nicer visual than the drop down lists of Day, Month, Year.
I hope this question is clear and thank you for any help

Excel does not have a date picker calendar control out of the box that seamlessly works in all versions. There are some ActiveX controls that can be used in earlier versions, but they won't work with later versions.
Ron de Bruin has written a VBA data picker tool that works in all Excel versions and has a collection of info about the calendar control on his page here: http://www.rondebruin.nl/win/s8/win003.htm

Related

Is there a script I can use to hide columns based on dates which have now expired?

I have developed a project workbook which features a GANTT chart. I am looking to set up a button which allows the user to automatically hide (and then show) any date columns which are in the past.
I have looked at office scripts online but I can't quite figure out how to get it working.
Any help would be greatly appreciated.
Tried a few different scripts online but no specific to my scenario

Using VBA to create one masterfile from multiple closed files. All closed files are saved under the same folder, same format

After days of trying to solve this task, I found this great forum and hope you guys can help (I am rather new to VBA...).
In a nutshell, we have monthly reports with a lot of data. These monthly files are always stored in the same folder with the same format (format e.g. Overview 2018.01 final.xlsx & Overview 2018.02 final.xlsx). I am working on one Masterfile able to update automatically and fill in all necessary data from these closed workbooks.
So, currently for example we are in month August. I created an UPDATE command button and if you click it, I would like excel to get data from the file "Overview 2018.08 final.xlsx", perform a sumif function (sum all numbers linked to the ordernumber P123, P124 etc) and paste it the Masterfile.
Next month, in September I would like that once you press the command button, it updates again August data AND includes data from the September file ("Overview 2018.09 final.xlsx") and so on...
What would be the simplest code to perform that?
I hope its clear and you guys can help me. Would be really grateful.
All the best
This is a perfect problem for Power Query -- it's a Microsoft add-on for Excel 2010/2013, and is built-in to 2016.
PQ will allow you to open, merge, and manipulate (e.g. parse, sum) the files as you described.
Good luck

Excel 2007: Editing a date value deletes the date format

In an Excel 2007 spreadsheet when I edit a date value the date format of the cell is deleted and I cannot re-apply it with the toolbar options, format > format cells > number > date.
Prior to editing the date value the cell is displayed in the formula bar as 2017/07/15 (for example) but after an edit it displays as ^2017/07/26.
The onset of the problem was sudden and it affects all my Excel 2007 spreadsheets, old and newly created.
I have Goggled the problem and posted a question in MS Forums but without result.
Any help would be appreciated.
Additional Information - Update Oct 3
I have found a January 6, 2016 Stack Overflow question about Excel 2013 date format changes caused by editing and one of the answers seems to be relevant to my question. The cells I am attempting to edit have typed (non-formula) dates in them.
Quote from Date Format changes when editing a cell in Excel 2013
Answer by Jeeped
… When you edit a cell with a typed (non-formula) date, you are editing the Range.Formula property which in this case is the same as the Range.Value property. The displayed (formatted) date is the Range.Text property. The Range.Formula is the same as that which is seen in the formula bar and the stored format for a typed date is taken from the computer system's regional Short Date setting. The Range.Text property is subject to a formatting mask that changes the way the Range.Value is displayed. Consider it an overlay of the actual value; e.g. if you want to change something, change the something, not a picture of the something.
If you were allowed to edit the displayed text, you would never be able to edit a formula because the values being edited would always be the formula's result (formatted appropriately) and not the formula itself.
If this is really mission critical or just obsessively annoying, change your computer system's Short Date to dd-mm-yyyy and Excel will use that as the base Range.Formula property.
End of quote
This quote gives links to the Microsoft Dev Center ,
https://msdn.microsoft.com/VBA/Excel-VBA/articles/range-formula-property-excel
I am a basic user of Excel and assuming the above information can be used to solve my editing problem then my problem now becomes how do I use this information?
It is less pressing, but I am also curious about why an editing feature I had been using for a long time suddenly stopped working.
Problem Fixed – Update Oct 20
#a-burge: Thanks for taking an interest in this problem but I have fixed the problem so I am answering my own question.
I use Windows 7 Ultimate SP1 and Microsoft Office 2007 SP3 which have always been updated automatically through Windows 7 > start > control panel > windows update.
The sequence of selections, Windows 7 > start > control panel > region and language, leads to a page with tabs that include a "formats" tab and a "location" tab. Under the former the language setting was "English (New Zealand)" and under the latter the location setting was "New Zealand".
The problem was fixed by changing the language setting to "English (United States)". The location setting was left unchanged.
This fixes the problem but I do not understand how a language setting in the control panel of Windows 7 can have the effect it does on editing a date in an Excel 2007 spreadsheet?
I think a family member who also uses the computer must have changed the language setting which would account for the sudden onset of the problem and its simple solution.
This is not the first time I have had a problem caused by a language setting in a Microsoft product. In Word 2007 the autocorrect option that I use to expand abbreviations when writing may suddenly stop working. This is caused by the variant of English changing from one part of the document to another. The solution is Word 2007 > select all > set language but that may need to be repeated several times in one document depending on the editing.
These problems raise the question of why Microsoft provides 16 variants of English in Windows 7 when the differences between them are trivial. It even provides English(Australia) and English(New Zealand) and English(United Kingdom) which is an absurd level of redundancy.

Excel Workbook Versioning via SharePoint

I have an Excel workbook with several SharePoint data connections that builds up a dashboard of various statistics. My issue is that there have been several different versions of the dashboard, and I need to make sure that everyone keeps up to date. To this date I have done the following :
The front worksheet of the dashboard has the version number of that sheet in cell Z1.
On SharePoint I have created a list containing the latest version number of the dashboard.
On the dashboard I have created a data connection to the SharePoint list containing the version latest number, which populates a hidden sheet on the dashboard.
On opening the workbook, a modal form pops up. In the load of that form, it performs a check between the local version number (cell z1) and the latest version number on the hidden sheet.
The problem that I am having is that the version check in the modal form is being executed before the workbook data refreshes - not good.
Is there any way that I can get the version check to occur after the data connections have all refreshed, or is there a simple way that I can get the latest version number from SharePoint directly in the vb code of the modal form.
Cheers, Pete
Just wanted to share my solution. I disabled the refresh on open to the versioning list and added VB into the form initialise in the modal form to perform that refresh. Because the refresh command is before the version check code, I know that the version check is looking at the latest data and not a pre-refresh button. Thanks Scott.

Excel 2013 Pivot table won't change current page until navigated to manually

We have a little piece of VBA code that worked perfectly for ages. It was essentially:
Me.PivotTables("APivot").PivotFields("AField").CurrentPage = "Some text"
This worked until Excel 2013, where the line would fail with an unspecific error:
Runtime error 5:
Invalid procedure call or argument.
By trial and error we figured that in Excel 2013 you cannot navigate to a pivot table page with code until the user has navigated to that page manually using the Excel interface. As soon as the user navigates to a page, navigating to that page with code will always succeed (until you close the workbook). So in order for the code to be able to navigate to any page, we first need the user to go through all of them manually.
A workaround to that would be changing the value of the underlying cell instead:
Me.PivotTables("APivot").PivotFields("AField").CurrentPage.LabelRange.Value = "Some text"
We are currently forced to use this workaround, but it feels hackish.
Exactly what in Excel 2013 causes this behaviour? Is there some bit one now needs to do first in order to navigate to a page (poke something, load some data in some way etc)?
EDIT: Same problem occurs in Office 2016.
I'm not sure how they become "hidden" in the first place, but I just ran into the same problem and found this post.
The solution from there is to right-click the filter field (on the spreadsheet cell, not the field list) and under field settings, make sure the items are not hidden.

Resources