ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: ctp_119

[原创] 跟我学JavaScript in WPS

  [复制链接]

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-5-1 16:46 | 显示全部楼层
OKJSJSF 发表于 2024-5-1 14:58
二个数组直接可以并成一个,真方便多了。

现在工作表函数也可以了。学好工作表函数,都可以实现编程思想的数据处理

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-5-1 16:47 | 显示全部楼层
OKJSJSF 发表于 2024-5-1 12:21
版主好!不知with...end with在JSA中要怎么写了?还有,微软的方法application.inputbox("请选个列标题单 ...

用变量替代,,,

TA的精华主题

TA的得分主题

发表于 2024-5-1 21:30 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
ctp_119 发表于 2024-5-1 16:47
用变量替代,,,

我想用输出对话框显示在输入对话框中选定的单元格的地址,它是一个变量的属性(后续经常要被引用),不知怎么写在msgbox()。只能用debug.print显示在立既窗口中吗?

TA的精华主题

TA的得分主题

发表于 2024-5-1 21:51 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
不过我这种分二栏展示一条记录全部数据以便打印,主要是因为工作中系统经常下载到列数几十以上的,如我的银行的贷款明细表,有84列,还有客户走访授信表,有40多列,超过记录单上限,金山WPS的记录单与微软的一样,只能显示一条记录的31列。所以需要把一条记录与列标题分二次转置粘贴至另一区域,并增加一列自然数序号,共三列,再把它分为上下二段,各一半,下一半剪切,粘贴至右边,共六列(序号、列标题、数据、序号、列标题、数据),效果相当于Word的分二栏排版,这样一般17寸的屏幕最多可以同时显示100个字段数据,再多不行,字号太小不好。好像可能已经有类似效果的一列变多列的函数。

TA的精华主题

TA的得分主题

发表于 2024-5-1 21:54 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
下面把“全行数据一览无余”的宏录制代码全部附上。

TA的精华主题

TA的得分主题

发表于 2024-5-2 10:07 | 显示全部楼层
本帖最后由 OKJSJSF 于 2024-5-2 12:33 编辑

/**
* 全行数据一览无余 Macro
* 宏由 OKJSJSF 录制,时间: 2024/05/01
*/
function 全行数据一览无余()
{
        Range("A1:AA1").Select();
        ActiveWindow.ScrollColumn = 4;
        Selection.Copy(undefined);
        Sheets.Add(undefined, "Sheet1", 1, undefined);
        Range("B1").Select();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Range("A1").Select();
        Application.CutCopyMode = false;
        Application.DisplayAlerts = false;
        ActiveWorkbook.CustomDocumentProperties.Add("KSOProductBuildVer", false, 4, "2052-12.1.0.16388", undefined);
        Application.DisplayAlerts = true;
        Selection.Formula = "1";
        Selection.AutoFill(Range("A1:A27"), xlFillDefault);
        Range("A1:A27").Select();
        Range("C1").Select();
        Sheets.Item("Sheet1").Activate();
        Range("D3:AA3").Select();
        Selection.Copy(undefined);
        Sheets.Item("Sheet3").Activate();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Application.CutCopyMode = false;
        Sheets.Item("Sheet1").Activate();
        ActiveWindow.ScrollColumn = 1;
        Range("A3:Z3").Select();
        ActiveWindow.ScrollColumn = 2;
        Range("A3:AA3").Select();
        ActiveWindow.ScrollColumn = 3;
        Range("A3:AB3").Select();
        ActiveWindow.ScrollColumn = 4;
        Range("A3:AA3").Select();
        Selection.Copy(undefined);
        Sheets.Item("Sheet3").Activate();
        Range("C1").Select();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Range("A15:C27").Select();
        Selection.Cut(undefined);
        Range("D1").Select();
        ActiveSheet.Paste(undefined, undefined);
        Range("A1:F14").Select();
        Range("D1").Activate();
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeLeft));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeTop));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeBottom));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeRight));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlInsideVertical));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlInsideHorizontal));
        Selection.Borders.Item(xlEdgeLeft).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeTop).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeBottom).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeRight).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlInsideVertical).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlInsideHorizontal).ColorIndex = xlColorIndexAutomatic;
        Range("A1:C14").Select();
        (obj=>{
                obj.Weight = xlThick;
                obj.LineStyle = xlDouble;
                obj.ColorIndex = xlColorIndexAutomatic;
                obj.TintAndShade = 0;
        })(Selection.Borders.Item(xlEdgeRight));
        Columns.Item("A:F").Select();
        Selection.AutoFit();
        Selection.Font.Bold = true;
        Selection.Font.Bold = false;
        Selection.Interior.Pattern = xlPatternNone;
        (obj=>{
                obj.ColorIndex = xlColorIndexAutomatic;
                obj.TintAndShade = 0;
        })(Selection.Font);
        Range("G1").Select();

}/**
* 全行数据一览无余 Macro
* 宏由 OKJSJSF 录制,时间: 2024/05/01
*/
function 全行数据一览无余()
{
        Range("A1:AA1").Select();
        ActiveWindow.ScrollColumn = 4;
        Selection.Copy(undefined);
        Sheets.Add(undefined, "Sheet1", 1, undefined);
        Range("B1").Select();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Range("A1").Select();
        Application.CutCopyMode = false;
        Application.DisplayAlerts = false;
        ActiveWorkbook.CustomDocumentProperties.Add("KSOProductBuildVer", false, 4, "2052-12.1.0.16388", undefined);
        Application.DisplayAlerts = true;
        Selection.Formula = "1";
        Selection.AutoFill(Range("A1:A27"), xlFillDefault);
        Range("A1:A27").Select();
        Range("C1").Select();
        Sheets.Item("Sheet1").Activate();
        Range("D3:AA3").Select();
        Selection.Copy(undefined);
        Sheets.Item("Sheet3").Activate();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Application.CutCopyMode = false;
        Sheets.Item("Sheet1").Activate();
        ActiveWindow.ScrollColumn = 1;
        Range("A3:Z3").Select();
        ActiveWindow.ScrollColumn = 2;
        Range("A3:AA3").Select();
        ActiveWindow.ScrollColumn = 3;
        Range("A3:AB3").Select();
        ActiveWindow.ScrollColumn = 4;
        Range("A3:AA3").Select();
        Selection.Copy(undefined);
        Sheets.Item("Sheet3").Activate();
        Range("C1").Select();
        Selection.PasteSpecial(xlPasteAll, xlPasteSpecialOperationNone, false, true);
        Range("A15:C27").Select();
        Selection.Cut(undefined);
        Range("D1").Select();
        ActiveSheet.Paste(undefined, undefined);
        Range("A1:F14").Select();
        Range("D1").Activate();
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeLeft));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeTop));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeBottom));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlEdgeRight));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlInsideVertical));
        (obj=>{
                obj.Weight = xlThin;
                obj.LineStyle = xlContinuous;
        })(Selection.Borders.Item(xlInsideHorizontal));
        Selection.Borders.Item(xlEdgeLeft).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeTop).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeBottom).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlEdgeRight).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlInsideVertical).ColorIndex = xlColorIndexAutomatic;
        Selection.Borders.Item(xlInsideHorizontal).ColorIndex = xlColorIndexAutomatic;
        Range("A1:C14").Select();
        (obj=>{
                obj.Weight = xlThick;
                obj.LineStyle = xlDouble;
                obj.ColorIndex = xlColorIndexAutomatic;
                obj.TintAndShade = 0;
        })(Selection.Borders.Item(xlEdgeRight));
        Columns.Item("A:F").Select();
        Selection.AutoFit();
        Selection.Font.Bold = true;
        Selection.Font.Bold = false;
        Selection.Interior.Pattern = xlPatternNone;
        (obj=>{
                obj.ColorIndex = xlColorIndexAutomatic;
                obj.TintAndShade = 0;
        })(Selection.Font);
        Range("G1").Select();

}

TA的精华主题

TA的得分主题

发表于 2024-5-2 10:11 | 显示全部楼层
本帖最后由 OKJSJSF 于 2024-5-2 10:14 编辑

数据源:
image.png

TA的精华主题

TA的得分主题

发表于 2024-5-2 10:19 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2024-5-2 10:23 | 显示全部楼层
示例数据只有27个字段,实际是不需分栏的,用记录单即可一览无余。一般40多列时才需要分栏。
image.png

TA的精华主题

TA的得分主题

发表于 2024-5-2 12:07 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
本帖最后由 OKJSJSF 于 2024-5-2 12:16 编辑

所谓记录单,就是类似纸质表单的展示一条记录的全部数据的单据凭证。它的具体作用还包括作为新增或修改数据的窗口。在微软Office中,这种布局叫堆积,这种界面叫窗体,Excel表格中的列标题改名叫标签,布局在左边,属性值即具体的数据改名叫字段,布局在右边。
image.jpg
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-5-22 11:15 , Processed in 0.039659 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表