Using Google Scripts assigned to Macro buttons to move rows

November 20, 2020 at 10:04:36
Specs: Windows 10
I would like to use macro buttons to move rows from one tab to another. I have already created the buttons; however, it has been hard creating a google script that works for my case.


Basically, when a user submits a response, the row can be moved to the "Marketing" tab if it is indicated as complete. In the "Marketing" tab the row can either be moved to the "Not Approved" or "Supervisor" tab if *Not approved* or *Approved* is selected from the drop-down. There are two buttons in the "Marketing" tab.

Here's my googl sheet: https://docs.google.com/spreadsheet...


See More: Using Google Scripts assigned to Macro buttons to move rows


#1
November 20, 2020 at 10:44:09
The link to the Google sheet doesn't help if we can't edit it or view the macros that you created.

The sheet is asking me to send you a message requesting to become an editor. If I am not mistaken, that is going to reveal some portion of my identity to you.

Nothing personal, but since I don't you, and you just joined this forum today, I'm just a tad (as in very) hesitant to contact you through the Sheets editor request function.

Either open the sheet for public editing ability or post the code you have in this forum and we'll take a look at it.

All that said, I'm not sure that there is anyone in this forum that is "expertly familiar" with Google Sheets macros, but we can certainly give it a try. I, for one, am always willing to learn. ;-)

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

#2
November 20, 2020 at 10:59:14
@DerbyDad03 I have given edit access to anyone with the link.

Reply ↓  Report •

#3
November 20, 2020 at 10:59:44
@DerbyDad03 I have given edit access.

Reply ↓  Report •

Related Solutions

#4
November 20, 2020 at 11:38:18
The script editor says "Page not found."

You said: "however, it has been hard creating a google script that works for my case"

Have you actually created any code?

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

#5
November 20, 2020 at 11:44:21
I created this script for moving rows from the "Form Responses" to "Marketing Dept"; however, I keep on receiving an error with Line 20.

function approved() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Form Responses 1'); //source sheet
var testrange = sheet.getRange('H:H'); //range to check
var testvalue = (testrange.getValues());
var csh = ss.getSheetByName('Marketing Dept'); //destination sheet
var data = [];
var j =[];

//Condition check in B:B; If true copy the same row to data array
for (i=0; i<testvalue.length;i++) {
if ( testvalue[i] == 'Complete') {
data.push.apply(data,sheet.getRange(i+1,1,1,10).getValues());
//Copy matched ROW numbers to j
j.push(i);
}
}
//Copy data array to destination sheet

csh.getRange(csh.getLastRow()+1,1,data.length,data[0].length).setValues(data);

//Delete matched rows in the source sheet
for (i=0;i<j.length;i++){
var k = j[i]+1;
sheet.deleteRow(k);

//Alter j to account for deleted rows
if (!(i == j.length-1)) {
j[i+1] = j[i+1]-i-1;
}
}
}

message edited by Einstein


Reply ↓  Report •

#6
November 20, 2020 at 12:25:04
I'm going to pass on this.

When I try to run the script I get a message requesting access my data on Google.

I'm not going to grant that permission just to test your script.

Sorry.

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

Ask Question