I honestly didn't know how else to word that title, but what I'm wanting to know if it's possible is to be able to have many sheets that represent data, and have a front page that looks up the needed values, but allows you to change the referenced values by changing the cell that is displaying, basically like you would be able to do with an object reference in Java, where you could create a new variable with the original object, but changes to the new variable would change the original object.
If it requires VBA, I'll likely just make a quick mobile or web-mobile app to do the same thing. I just wanted to know if it was possible, since the entire thing is already in Excel, and I didn't even know what terminology to search for to find it on my own.
Related
I need to add some information to an Excel cell or the same information to several selected Excel cells and that information should not be visible. How is this possible? I know I could add something to the properties of the whole worksheet, using the addresses (e.g. "Sheet1!A1") of the cells, but then when the table changes, the information is no more correct. I also thought I could use addFromSelectionAsync, but did not manage to use it, I think addFromSelectionAsync is not the right tool. I have seen that other AddIns are producing something like the follwoing (in different files in the saved Excel document): [UPDATE: this is not the way to go, see my second comment below]
<x15:webExtensions xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
<x15:webExtension appRef="{12345678-...}">
<xm:f>Sheet1!$A$1</xm:f>
</x15:webExtension>
<x15:webExtension appRef="{ABCABCAB-...}">
<xm:f>Sheet1!$A$2</xm:f>
</x15:webExtension
</x15:webExtensions>
<we:bindings>
<we:binding id="BINDING-ID-1" type="text" appref="{12345678-...}"/>
<we:binding id="BINDING-ID-2" type="text" appref="{ABCABCAB-...}"/>
</we:bindings>
and then use <we:properties> (I think) to know which binding-IDs are used. Is this the way to go, will the values in <xm:f> automatically be updated, and how do I do this in code?
Thanks in advance.
The first part was already resolved see my old comments above:
addFromPromptAsync, using the information I want to save as the ID, adds the <x15:webExtension> and the according <we:binding>.
I am now using a UUID as the value in addFromPromptAsync, and setting the actual value via Office.context.document.settings.set with key = the UUID and value = the actual value.
It was then my question:
given a cell (i.e. the accordings range) I cannot get the IDs of the according bindings
For this second part of the problem, I added event handlers via binding.addHandlerAsync for the relevant Binding-IDs. Those event handler can read the binding ID from the event data.
So my problem is resolved, since I only need the Binding ID when the according cell is selected.
There is still the problem that I need to unset the binding ID that I save in a variable when another cell without that data is selected, I am using a timestamp for this, >200ms after the last binding selection event, selecting another cell deletes the info. Cf. my question Can I set an order for the Event Handlers in Office.JS? for that last point.
Typically when referencing a userform control value in Excel VBA I would enter something to the effect of radiobutton.value
However, I want to be able to use a string as the name of the user control. The idea behind this would be to dynamically be able to generate the control name and reference a value from it.
For example I may want to reference ctradiobutton.value one time, and etradiobutton.value the next, these controls already exist on the form, I just want to reference a different name of the control from a string created on the current iteration.
Like this (where Me is the UserForm)
Me.Controls("TextBox1").Value
The question pretty much says it I guess. For detailed information:
I have a range of cells (F3:F2000) in which there can be names filled in. I want to be able to count the amount of times, a name has been mentioned. I am doing this with =COUNTIF(...), which is not the problem and works perfectly fine. But I want to be able to have a cell with a dropdown menu in which you can choose from all names mentioned in F3:F2000. My approach so far is to create a dynamic list, and then use this for the dropdown menu. But obviously it just uses all the entries and therefore I get a bunch of the same names. So how do I remove the duplicates? I assume this has to be done in the dynamic list.
Here is my formula for the dynamic list:
=OFFSET(Logbook!$F$3:$F$2000,0,0,COUNTA(Logbook!$F$3:$F$2000)+1,1)
And for those stuck with german excel like me :(, the german version:
=BEREICH.VERSCHIEBEN(Logbook!$F$3:$F$2000;0;0;ANZAHL2(Logbook!$F$3:$F$2000)+1;1)
Take a look at this posting, I think it answers your question.
http://www.get-digital-help.com/2009/05/25/create-a-drop-down-list-containing-only-unique-distinct-alphabetically-sorted-text-values-using-excel-array-formula
I've been finding the answers I need here on StackOverflow for months (thank you all!) but so far my search terms aren't finding the result I need this time... hence, my first post here...
I have an Excel file that includes two UserForms:
The first is used to input certain invoice data and then export that data in a format that can be uploaded into our proprietary accounting system.
The second is later used to post payment data against those invoices and then, similarly, export that data in a format that can be uploaded into our accounting system.
The second form has to be created dynamically in Userform_Initialize, because the number of payments required (and, thus, the number of TextBox and Label controls created) varies depending on the size of the invoices. I've finished the code to create this second form and it works well, but I'd like to add some functionality that is triggered when some of these dynamically created controls are changed by the user.
I've done this in other forms using a given control's _Change() procedure (for example, when I want to move to the next box after entering a dollar amount, I use _Change() to SetFocus elsewhere as soon as the value has two digits after the decimal). So my question is: how can I establish _Change()-style procedures for controls that don't yet exist before the form is initialized? Is there a way to set a "global" _Change() procedure that I can use to loop through text boxes and use if/then/else statements based on their dynamic names?
Any tips would be greatly appreciated!
When I am using dynamic forms, I like to create object arrays to store the relevant information so that I can quickly and easily reference the objects by "name".
I'm working with the Open XML SDK to create an Excel document. To save time, I start with an existing document, and just make the changes I need.
To locate certain cells, my existing document defines a number of ranges. However, when I'm done I'd like to remove those ranges.
I can't seem to find any way to remove ranges from an Excel document that already has them. Any tips, suggestions or links?
Ranges are stored as defined names under the workbook element. You will need to find the defined name element based on the name you gave it in the worksheet and then delete it that way.
public void DeleteRange(WorkbooPart workbookPart, string definedNameToDelete)
{
workbookPart.Workbook.DefinedNames.Descendants<DefinedName>().First(x => x.Name == definedNameToDelete).Remove();
}
This is just a quick snippet of what you might have to do. Obviously, you might need error checking if the DefinedNames element doesn't exist or the defined named you want to delete has already been deleted, but hopefully this will point you in the right direction.
Named ranges are defined in workbook.
Look at it's api and try finding it there. Or check out MSDN.
Also, take a look at Templater. Maybe it already does what you need. Disclamer: I'm the author.