Reputation: 3
I was searching for a way to force text in certain cells to UPPER CASE and came across a post at https://productforums.google.com/forum/#!topic/docs/QaRXTzt6lbw.
I am new to scripting and I found this to be very helpful. I was able to make it work, but only in 1 column.
My dilemma is I am trying to make multiple columns force UPPER CASE letters.
I want it to start on row 4 of all specified columns. I am looking for the script to run on columns 2, 5, 10-14 & 18-29. More specifically, I am looking to make this work on a set range (B4:B53, E4:E53, J4:N53, R4:AC53)
If anyone can offer any insight on how I can make this happen, it would be very greatly appreciated.
I should mention that I have tried several ways to modify the formula in the above mentioned script, but have been unsuccessful in making it work. The most I can make it do is work for column 2 and 5.
Thanks.
Upvotes: 0
Views: 2839
Reputation: 27282
See if this works (change sheet name to suit)...
function onEdit(e) {
var ss = e.source.getActiveSheet(),
sheet = 'Bets';
cols = [2, 5, 10, 11, 12, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
if (ss.getName() !== sheet || e.range.rowStart < 4 || e.range.rowStart > 53
|| cols.indexOf(e.range.columnStart) == -1) return;
e.range.setValue(e.value.toUpperCase());
}
Upvotes: 1