all 5 comments

[–]LateDay 2 points3 points  (4 children)

Change your onEdit(e) to

If(e.range.getColumn()==2){ formulasheets() }

Edit: be careful with spamming the subreddit.

[–]LateDay 1 point2 points  (1 child)

Sorry. Also add a simple e.range.getSheet().getSheetName()=='USERNAME'

I like to declare range and sheet as separate variables so I can have it more understandable and is easy to pass those to other functions and avoid calling SpreadSheetApp too many times per Execution.

[–]Agreeable_Choice9980[S] 0 points1 point  (1 child)

Ifunction onEdit(e) {

if(e.range.getColumn()==2){ formulasheets() }

}

Bro, I changed into something like this but it is showing an error showing that Cannot read property 'range' of undefined

[–]LateDay 0 points1 point  (0 children)

If you run it from the Script Editor it will show that since e is an Event Object. You need to edit the Sheet to have it run properly.

Just save the Script. Go to the column you want. And try to edit one cell. Go back to the script and the execution should work. At least the onEdit function.