In-Cell Instructions
On Wednesday, July 22, 2009 at 9:46:02 PM UTC+5:30, mckillmt wrote:
I want to have 'in-cell' instructions (i.e. "Enter Length Here"). I want the
instructions to be in a light grey, and when the user enters their data (into
the same cell as the instructions), the number is in black. How to I get the
cell to automatically change colors from grey to black when a user enters
data?
Hey Try using this script:
function format_1() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByNa me("Sheet1");
var range = sheet.getRange("C20:H20");
if (range.isBlank()) {
range.setValue("Enter Length Here").setFontColor("grey");
}
}
function onEdit(e){
var range = e.range;
if(range.getRow() == 20 && range.getColumn() = 3 && range.getColumn() <= 8){
var value = range.getValue();
if(range.isBlank()){
range.setValue("Enter Length Here").setFontColor("grey");
}
else if(!range.isBlank() && range.getValue() != "Enter Length Here"){
range.setFontColor("black");
}
}
}
|