本文介绍了带弦线的制作范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这句话:
var destinationRange = destinationSheet.getRange("D26:E39");
并希望将其替换为
var destinationRange = destinationSheet.getRange(daGrowaRange);
我要使用daGrowaRange的原因不仅仅是导致da名称,而且范围并不总是相同.
The reason I want to use daGrowaRange is not just cause da name, but that the range is not always the same.
- D是一个固定的常数,永不改变
- E是一个固定常数价值,永不改变
但是
- 26是动态变化的,并且
- 39是基于26(在这种情况下13等于39 = 26 + 13,但是13也是一个变量值.
我确信我可以用一些丑陋的方式将它们组合在一起,但是我讨厌看我糟糕的代码,并且想学习如何破解它,使它变得更好.
I am sure that I could put this together in some ugly ass way, but I am sick of looking at my crappy code and want to learn how you crackz out there make it nice.
谢谢
推荐答案
您可以使用模板文字以完成此任务:
You can use Template literals to accomplish this task:
const dValue = 26;
const eValue = dValue + 13;
const daGrowaRange = `D${dValue}:E${eValue}`;
const destinationRange = destinationSheet.getRange(daGrowaRange);
这篇关于带弦线的制作范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!