google sheets – How do I write a script that exits a cell that is being edited

If I enter a value in cell A1 without exiting the cell 1. Before I exit editing A1 I run a script that at some point selects another cell B1 2, while A1 is still being edited. When I then click C1, the value moves along to the cell B1 before C1 is selected 3. That is what I want to prevent. The value should remain in A1 when the script selects B1 and I select C1.

How do I call for the initial state of cell A1 being edited to stop before I select another cell.

script for a button to add value of cell to existing value of cell on another sheet, google sheets

I’m trying to make a button on a spreadsheet for an apparel manufacturing business, I have one sheet that we use for stock on hand that then feeds requirements into two other sheets for cutting and sewing based on minimum stock levels, I want to create buttons on the sewing and cutting sheets where I can enter the amount of the item we have cut or sewn click the button and it adds it to stock levels

example, item A is 5 in stock we need 8, so sewing sheet says to make 3 (witch the sheet already does) but when I make that 3 then I want to be able to add the new ones into the stock on hand and minus the ingredients used from that stock on hand from a cell on sewing sheet.

I’m a complete newbie to script I understand the basics of using but barely anything about writing it

any advice would be greatly appreciated

EDIT: sorry super new to this still learning how to ask questions and still only kinda understand what I’m actually asking for, I have scoured the internet for the answer but was only able to find it for excel not google sheets. up until about 3 weeks ago i had never even used a spreadsheet so im kinda learing on the fly.

I have attached some images of the sheets I’m working on witch hopefully provides the information your asking for.

sewing req sheet

so on sheet “sewing req” if I made 5 black on black left faceplates I would put 5 in C2 then hit the “add” button I have put in D2 to run the script witch would do the following,

stock on hand sheet 1

it would add 5 to the existing total in C110 on sheet “stock on hand” (this cell has no equations in it just a number we manually enter during stocktakes) then,

stock on hand 2

it would also minus 5 from cells C78 and cells C66 on sheet “stock on hand” as these ingredients have been used up,

then it would clear the number out of cell C2 on sheet “sewing Req” I already have the script for the clear part.

I understand I would have to create a heap of these macro scripts for each individual button with minor changes to begging and end cell sources as the information jumps around a bit between the pages

EDIT

I have figured out a solution by frankenstiening some script


/** @OnlyCurrentDoc */

function adjust() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sourceSheet = ss.getSheetByName("sewing req");
  var targetSheet = ss.getSheetByName("Stock on hand");
  var New = sourceSheet.getRange("C2").getValue();
  var Old = targetSheet.getRange("C10").getValue();
  var ing1old = targetSheet.getRange("C78").getValue();
  var ing2old = targetSheet.getRange("C66").getValue();
  targetSheet.getRange("C10").setValue(New+Old);
  targetSheet.getRange("C78").setValue(ing1old-New);
  targetSheet.getRange("C66").setValue(ing2old-New);


    sourceSheet.getRange('C2').clearContent();
}

google docs – Conditional Formatting Based on another Cell with Multiple IF’s

So.. I had a Conditional Format in Place, but it somehow stopped working once I filled in an IF Argument into my Cell.

A1 Contains a Number I put in manually
A2 Contains another Number I put in manually
A3 Contains a Number which changes (with IF Arguments) depending on which number is input into A1

A3 Is supposed to change it’s color depending on which Number it contains.

My Argument for A3 is =IF(A1=1, “3”, IF(A1=2, “6”, IF(A1=3, “3”, if(A1=4, “6”,”N/A”))))
I had my Conditional Format on Cell A3 as “Custom Formula is” with the Formula being =A2=A3 -> Green, and a second one as =A2<A3 -> Red

Problem with Initialization cell and Manipulate

The following minimum failing example illustrates a problem that I am having building an application to simulate projectile motion.

In the notebook’s initialization cell, I have the definition of a function FlightDuration. It serves as a stand-in for a library function that computes the duration of the projectile’s flight from its initial conditions.

(* Initialization cell *)
FlightDuration((* arguments *)) := 16.3;

The main input cell of the notebook contains a Manipulate for setting the values of the initial conditions and a Trigger for running the simulation.

(* Normal (Input) cell: *)
Manipulate(
 Module({sol=DSolve({y''(t)==-9.8,y'(0)==80,y(0)==0},y,t)},
  flightDuration=FlightDuration((* control values *));
  Plot(
   y(t)/.sol,
   {t,0.0001,time},
   PlotRange->{{0,flightDuration},{-50,400}},
   ImageSize->500
  )
 ),
 (* other controls supplying values to FlightDuration *)
 {{time,0.},0.,flightDuration,ControlType->Trigger},
 {{flightDuration,FlightDuration()},None}
)

When I close the normal cell, save the notebook, quit Mathematica and restart Mathematica by double clicking the notebook, the Output cell shows a red border and I see the error message:

General: Value of option PlotRange -> {{0,FlightDuration()},{-50,400}}
is not All, Full, Automatic, a positive machine number, or an
appropriate list of range specifications.

However, if I then click the Play button, the simulation works as expected.

My initial (naive) expectation was that the evaluation of the initialization cell should complete before any displays are updated. Further reflection suggested that perhaps the front end was trying to update the display at the same time that the kernel was evaluating the initialization cell. I tried various ways of delaying the re-display, such as using a semaphore, without success.

Q1: Does Mathematica provide an programmatic way for me to control when the initial display update takes place?

Q2: What is the best practice for initializing a notebook along the lines I am trying to do?

Note: Occasionally, when opening the notebook, the error does not occur. I take this to mean that there is some kind of timing dependency or race condition.

Environment: Mathematica: 12.1.0.0; MacBook Pro; Mac OS-X 10.13.4

google sheets – A Script that Allows a Checkbox to Recognise a Value via Formula and Copy to Another Cell

Is it possible for:

function onEdit(e) {
const sheet = e.range.getSheet();
if (sheet.getName() !== 'Sheet1' || e.range.columnStart < 3 || e.range.columnEnd > 3 || !String(e.value).match(/^(true)$/i)) {
return;
}
const valueToCopy = sheet.getRange(e.range.rowStart, 2).getValue();
const targetRange = sheet.getRange(e.range.rowStart, e.range.columnStart + 5);
targetRange.setValue(valueToCopy);
}

Please see the (Sample Sheet)(1) attached for a more detailed explanation.

Look forward to hearing from you.
Thanks,
DDS

Saving My Videos On My ATT Alcatel Cell Phone

I have a ATT Alcatel cell phone. Whenever I record a video it automatically saves to my phone and uses my phones memory. I want to change that so it always saves to my 32gb SD card. What steps do I take to achieve this??

google apps script – weird bug(?) with getValue returning “You are trying to edit a protected cell or object”

This is just…bizarre…

I’m running a function with a user that does have full Edit access to the Sheets in question.

This code:

function test() {
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('importDailyOrders');
  
  var column = sheet.getRange("A1:A");
  // Plain text
  column.setNumberFormat("@");
 
  var sheet = ss.getSheetByName('orderSummary');
  var data = sheet.getRange("A2").getValue();
}

…gives me this error “Exception: You are trying to edit a protected cell or object. Please contact the spreadsheet owner to remove protection if you need to edit. (line 11, file …”

But commenting out the setNumberFormat allows the function to run.

Note that the code works fine for the Sheet owner. This error only happens when running the script by a different user.

Is this a bug? If not…what’s happening?

How do I reference a cell for the sheet name in IMPORTRANGE function in Google Sheets when the sheet is in another workbook?

I have two workbooks with several sheets in each. I have a dropdown to select the sheet name that I’m using for reference for URLs and to reference other sheets in the main book.

I successfully used IMPORTRANGE to get data from the other workbook when I put the sheet name in it.

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/12Up9RK9bveEPN35iXq3V1QouJMgXELgzzoOdLnID5lU/edit?usp=sharing", "AMT!B2:M8")

AMT needs to be replaced with the value from another cell.

I’ve referenced cells in other sheets using INDIRECT

, but not sure how to do it in this case in this particular string.

I’ve tried doing it a number of different ways, and this is my most recent attempt

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/12Up9RK9bveEPN35iXq3V1QouJMgXELgzzoOdLnID5lU/edit?usp=sharing", "INDIRECT("'"&D4&"'!B2:M8")")

microsoft excel – Referencing a cell from the name of another cell in another workbook

I have to reference grid coordinates in a report, however I am given map references and then I have to transfer the grid coordinates from the map reference.
For eg:
Worksheet One:
Map reference is D-2 and in the next cell are the map coordinates 703370 – 7750584
In Worksheet 2 I want to be able to type in D-2 and have the cordinates show.There are hundreds of map references, so is it also possible to copy the formula for the whole list?
Microsoft Office Standard 2016

Is this possible?
Thanks so much

audio – Turn off the Cell Radio?

Any way to simply turn off the cell phone radio?

This need has come up in ZOOM sessions using the zoom app because that app uses the “phone audio” rather than “media audio”

As a result, it is impossible to include meeting audio if you ChromeCast the session. The video works, but the audio only outputs using the phone’s speaker or audio jack. Testing using an android tablet rather than an android phone shows that since the tablet does not have a cellular radio, the meeting audio is cast with the video.

Airplane mode is not an option since that would prevent connecting to the internet.

In addition, trying to address the audio using a bluetooth speaker doesn’t work either… while it’s possible to initially send bluetooth audio to the speaker, something unknown turns that off after a few minutes.

Any thoughts on addressing this would be appreciated.
Beverly Howard