Google Sheet Global onEdit - google-sheets-api

Is it possible to use the onEdit function to fire on multiple SpreadSheet, and then just have a switch statement for each individual SpreadSheet?

From this documentation, the onEdit() trigger runs automatically when a user changes the value of any cell in a spreadsheet. Most onEdit() triggers use the information in the event object to respond appropriately.
So it is not documented if you can use this onEdit() for multiple Spreadsheet, but I found here a SO question that explains how to use or apply onEdit() trigger function to multiple sheets.
Check also this thread if it can help you.

Related

filter selection prompt by user

i want to run my code such that it can pause and allow user to filter a column and then the code continues to run. Is this possible?
I thought of using inputbox to prompt user to key in the name. However, this is not feasible because user may not be able to remember the exact name. It will be more convenient for the user to look at the drop down list and select the name he wants to filter.
Please advice me how can this be done. Thank you
You can't stop a VBA macro to wait until an action was done within Excel.
I see the following possibilities:
a) Create a small userform showing a dropdown. If you show that form modal (that is the default), the macro will pause and wait until the form is closed. However, you will need to implement code to fill up the dropdown and to set the filter by code.
b) End your macro and implement an event that fires when the user changes the filter. There is no "On filter change"-event in Excel, but there is a work around: Excel VBA Filter Change event handler. Put the second part of your code into a separate sub and call that from the event handler.

Adding code to new excel sheet dynamically

I need some help Regarding VBA.
In My code I add an excel sheet and rename it and add a validation list to it.I need to run some code on changing value in that validation list.And that must run only on change of that particular cell.
If I am not clear please let me know.Please Help me solving this.
Instead of trying to create the individual code for each new worksheet with the Visual Basic Extensibility (see this link for further reading), simply use the Workbook wide event Workbook_SheetChange (you need to place it in the ThisWorkbookmodule).
In this event code first check, if the worksheet which caused the event is one of the newly created worksheets. This can be done most easily, be checking the .Name of the worksheet.
you can use SelectionChange Event and Change event or it is also possible to use the event Thisworkbook module. SheetChange or SheetSelectionChange.

Listen for Table Filter Activation

I have a table that has a series of filters across the top of it (as per usual.) This table feeds a massive graph that has multiple series of data in it. In order to hide different series of data I have grouped the information in the tables. I can then click on the minus button to remove a series of data from the graph by collapsing the group, or click the plus button to add it back in the same way. Yes, I know, not the best solution. It was an early effort, what can I say? My default is for all data to be hidden (all groups collapsed).
I have a user (a very important user) who wants to be able to use the filters across the top to find the specific series they are looking for. The filter will find the collapsed series just fine, but the series will not display because it is collapsed.
So, What I'm trying to do is get all groups to auto-expand when the filter is activated. This should work as a stop gap measure until I can simply redesign the chart.
The Problem: I can't figure out how to make Excel notice when the filter has been clicked on (or otherwise used). I've tried using Worksheet_Change and Worksheet_SelectionChange, but neither of them activate the code I have set up in the listener. That code, FYI, checks to make sure the filter is in use and adjusts the groupings accordingly. It should work fine if I can just get Excel to notice it's existence.
I've looked into making my own listener, but there's nowhere in the code I can insert it to make it activate. I just need a listener that will notice when the filter has been changed.
Any thoughts? After an hour of searching I'm stumped...
Okay, after some research I figured out a work around. The big problem here is that changing a filter does not raise any events that can be heard by VBA. Big problem.
Simple Solution: Create something that will activate a listener.
What I ended up doing was finding a cell somewhere outside of my table that wasn't going to be affected by the collapses, then I added a very simple formula (=Count(H:H)). Now whenever the table is collapsed the count is affected which activates the Worksheet_Calculate listener. And voila! I can dynamically change the groupings all I want :-).
So there you have it. If you need to detect a filter being activated via a Worksheet listener, you just need to set up a formula to activate the calculate listener.
Reference: [MSDN Article on the same thing].1 There is apparently a much more robust way to fix this problem as well which is detailed in the article.
You mentioned table, so assuming it's PivotTable you may try,
Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If it's simply a Targe Range change then,
If Intersect(Target, Range("A2"))

Google Spreadsheet onEdit not being triggered by row movement

I am trying to call onEdit() to renumber rows automatically when they are moved. As far as I can tell, it is only invoked if there is a change in cell text rather than position. Is there an alternative method, or a way to monitor the spreadsheet's activity to include row repositioning?

Create copy/paste button

Is it possible to create a 'COPY' and a 'PASTE' button in MS Access 2007 on a form.
Is there a code sample I could use, or a macro to copy a field and paste a field.
For API code to copy text to the clipboard:
http://www.mvps.org/access/api/api0049.htm
For getting data out of the currently active control, use:
Screen.ActiveControl.Value
Put these two together and you should be able to figure it out.
If you can't, just post back and I'll provide more detailed instructions.
(there's also DoCmd.RunCommand acCmdCopy, but the data you're copying has to be selected for that to work, so it's actually harder to code that than it is to use the API for the clipboard)