My group currently uses Excel workbooks to track performance of employees. Each employee has their own workbook and they are identical except for the user entered data. There are custom VBA formulas on this workbook that take the data and generate a score base.
What I would like to do is move these formulas to another workbook, that way if a calculation needs to be changed, it can be changed in one source document, as opposed to hundreds of workbooks.
I'm envisioning something like...
='[Source Formula Workbook.xlsm]'!Formula_A(A1, A2, A3...)
...where A1, A2, A3 are cells in the user workbook and this returns the value of Formula_A from my hypothetical source workbook. What's the right way to accomplish this?
The usual way to do this is to move the VBA functions to an XLA/XLAM addin and store the addin on a network drive. Then each employee needs to use the Excel Addin Manager (or an installer) to add the networked XLA to their Excel.
see http://www.cpearson.com/excel/createaddin.aspx on how to create an addin.
You can create a simple installer XLSM file that uses VBA to add the XLAM to the addins list:
With AddIns.Add(FileName:=MyNetworkAddInPath)
.Installed = True
End With
Related
I have an excel workbook which has the Office 365 default version control. The workbook is saved on sharepoint, so that multiple people can edit it at the same time.
However, some cells in this workbook are designed to change based on where the user's clicks with the cursor. Let's call them dynamic cells.
Theses dynamic cells contains a result that should only interest the owner of the cursor, and not the other users. This is problematic when multiple user try to see the result on a same dynamic cell, because the result will be correct only for the last person which has click on the workbook.
I don't want to version control these dynamic cells.
Is there a way to do it ?
For a basic git analogy to resume the problem, I'd like to add some excel cells to the .gitignore
I'm working with a list of addresses in excel 365. I want to perform a reverse geocode function to produce addresses from the available longitude and latitude info. to do this I have found an excel addin https://github.com/gramener/geocode-excel , which I downloaded. you can see an example in the screenshot above. the formula which it introduces is:
=#NominatimReverseGeocode(B32,C32)
Now what I want to do is make this available in my main sheet so that I can use the NominatimReverseGeocode. I've gone to File - Options - File - Add Ins
But the function 'NominatimReverseGeocode' does not show up in my main sheet. How can I make this function available in my main sheet?
EDIT:
I renamed the file to geocode.xlam in powershell. Now I'm getting:
If your intent is to make the Geocode functions available in all of your workbooks on your computer, do this:
Delete all previously saved Geocode.xlsm and Geocode.xlam files.
Download Geocode.xlsm.
Open it.
Go to File > Save As.
Change the file type from Excel Macro-Enabled Workbook (*.xlsm) to Excel Add-in (*xlam).
Click Save.
Close all instances of Excel.
Open Excel. (i.e. just the Excel application, so not opening a workbook.)
You should be on the Home screen.
Go to New > Blank workbook.
In the ribbon go to Developer > Excel Add-ins.
Check Geocode.
Click OK.
Close all instances of Excel.
Open any Excel workbook or make a new blank workbook.
Put =#NominatimReverseGeocode(51.5,-0.144) in any cell.
This should resolve to the Buckingham Palace Garden.
If your intent is to just have the geocode functions in one specific workbook, let me know and I'll write up the steps for that.
If you only need this code available for yourself and not other users by far the simplest way would be to create a personal macro workbook.
Create a workbook and save it as
C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.xlsm
Copy the code from the GeoCode workbook into PERSONAL.xlsm.
PERSONAL.xlsm will autoload with Excel. Prefix your function call with the workbook name: =PERSONAL.xlsm!#NominatimReverseGeocode(B32,C32)
Let's say I want to copy Cell C5 from workbook 2 to workbook 1. The name of workbook 2 is a variable given in Cell D1 of workbook 1.
The problem with using Excel's built-in Indirect() function is that the value disappears when workbook 2 is closed. I'm hoping there's a simple VBA macro that can do this.
Thanks in advance.
You seem not to have a lot of experience in Excel VBA, let me give you the general approach for such an exercise:
You can record macros: go to the "Developers" tab, start recording, do the thing you want to do (the copying) and stop the recording. There should be a macro, describing what you have done.
Unfortunately, when doing this, the macro will be something like this:
Source_Range.Copy
Destination_Range.Paste
Generally it is advised to replace this by something like this:
Destination_Range.Value = Source_Range.Value
Good luck and if you have any more problems while doing this, you might ask again by editing your question (I'll be following this question).
The behaviour you're observing isn't a limitation of the INDIRECT() function, but a more general limitation of Excel functions only having access to other workbooks when they're open.
You can use another workbook as a data source by selecting Data > Get Data > From File > From Workbook from the ribbon. Select the source sheet from the Navigator pane, and select Load. This will open the PowerQuery editor.
PowerQuery is an advanced topic which I won't attempt to fully address here, but the default transformation should give you a table containing data from the source worksheet, without relying on that workbook being open in another instance of Excel.
Can anyone help me out with this VBA Macros query? I want to compare a worksheet with another worksheet in a different workbook. However, I don't want to open that workbook when comparing. I just want to changes to be shown in the current worksheet that I am using.
Is there something like a temporary data storage using Macros which stores the data temporarily from another workbook, compares it without ever physically opening the workbook?
You don't need VBA for this. You can use regular worksheets formulas, even if the other file isn't open.
For example, if we want to compare cell A1 of the current worksheet to cell A1 on worksheet Sheet1 of an (open or closed) Excel workbook saved as c:\myPath\myFile.xlsm, we could use:
=IF(A1='C:\myPath\[myFile.xlsm]Sheet1'!A1,"It's a Match!","Not a Match")
More Information:
Office.com : Create an external reference (link) to a cell range in another workbook
Microsoft Press : How to Combine Data from Multiple Sources in Microsoft Excel 2016 (book excerpt)
I've noticed a possible bug in Excel 2010 v14.0.7106.5001 (32-bit). When copy-pasting two not adjacent cells (suppose A1 and C1) in workbook "BookA.xlsx" and pasting them in a second workbook open in a second instance of Excel ("BookB.xlsx"), the program paste not only the two cells I've selected but also the cell in between A1 and C1 (cell B1 from "BookA.xlsx").
Is this a known bug of MS Excel? Is there any way to work around it?
If you copy between 2 instances of excel, you will get the effect you have seen. If the sheets are in the same instance, then you will get the effect you desire.
Instances? Huh?
An instance of Excel is a separate Excel loaded in memory.
Each time you click on the Excel icon to start Excel, this Excel cannot communicate directly to the other Excels, and each one of these is called an instance.
If, instead, you go to the File - Open dialog, and open each spreadsheet, then there is only 1 instance of Excel, and the memory is shared, and the copy will work as expected.
How can I tell?
Look at the View menu, then Switch Windows. The names of the spreadsheets listed there are ones that can copy and paste as expected. If, however, there is only one name there (or you do not see the name you expect), then the other spreadsheet is in another instance, and Excel will copy all the cells in between, even if not selected.