Reputation: 133
I am trying to modify my current function to have it run different functions based on text in a cell.
If cell E9 is equal to 'New White Ticket' run WhiteTicket(). The issue I am having is modifying this to perform a different function if text is 'Old White Ticket.'
In other words,
If text equals 'New White Ticket run WhiteTicket(). If text equals 'Old White Ticket" run OldWhiteTicket(). If text is something else, do nothing.
function TypeofEMail() {
if(SpreadsheetApp.getActiveSheet().getRange("E9").getValue() =='New White Tickets') {
WhiteTicket();
}
}
Thank you
Upvotes: 0
Views: 24
Reputation: 102
You can add an else statement for "Old White Ticket" to run OldWhiteTicket() and an else statement getValue == "" then End If
function myFunction()
{
if(SpreadsheetApp.getActiveSheet().getRange("E9").getValue() =='New White Tickets')
{
Browser.msgBox("Test1")
}
else if (SpreadsheetApp.getActiveSheet().getRange("E9").getValue() =='Old White Tickets')
{
Browser.msgBox("Test2");
}
else if (SpreadsheetApp.getActiveSheet().getRange("E9").getValue() =='')
{}
}
The above code is tested and functional. Simply change the "Browser.msgBox" to run your code.
Upvotes: 1