|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
JSA代码,供参考
- function 转换(){
- let arr=Sheets.Item("Sheet1").Range("a1").CurrentRegion.Value2;
- let res=[["xx花名册"],["序号","姓名","证号","单位","代码","年份","备注1","备注2"]];
- for (let i=0;i<arr.length;i+=8){
- res.push(res[1].map((x,j)=>arr[i+j][0]));
- }
- Sheets.Item("转换后").Activate();
- Range("a1").Resize(1,res[1].length).Merge(),Range("a1").HorizontalAlignment=xlCenter;
- let rng1=Range("a1").Resize(res.length,res[1].length);
- let rng2=rng1.Rows(`2:${rng1.Rows.Count}`);
- [rng1.NumberFormatLocal,rng1.Value2]=["@",res];
- rng1.EntireColumn.AutoFit();
- [rng2.Borders.LineStyle,rng2.HorizontalAlignment]=[1,xlLeft];
- }
复制代码 |
评分
-
1
查看全部评分
-
|