EXCEL VBA 二维表转换成一维表
来源:互联网 发布:数值是优化算法与理论 编辑:程序博客网 时间:2024/05/09 14:19
EXCEL VBA 二维表转换成一维表
Sub 按钮2_Click() Rem 初始化 Worksheets(1).Activate Dim sizeArr(5) sizeArr(0) = "XS" sizeArr(1) = "S" sizeArr(2) = "M" sizeArr(3) = "L" sizeArr(4) = "XL" Dim col, row, productNum, refCol, targetRow targetRow = 1 Sheet2.Range("A1:A65536").Clear Dim iA As Integer Rem 交叉表转一维表 For row = 3 To 65536: Rem 处理行 If StrComp(Sheet1.Cells(row, 1), "") = 0 Then GoTo line: Rem 如果为空就中止处理 iA = Asc(Left(Sheet1.Cells(row, 1), 1)) Rem 如果不是英文字符开头,就跳过 If (iA >= 65 And iA <= 90) Or (iA >= 97 And iA <= 122) Then For col = 3 To 7: Rem 处理列 productNum = Sheet1.Cells(row, 1) & Left(Sheet1.Cells(row, 2), 2) Rem 取尺码对照表列号 If StrComp(Left(productNum, 1), "K") = 0 Then refCol = 4 ElseIf StrComp(Left(productNum, 1), "B") = 0 Then refCol = 3 ElseIf StrComp(Left(productNum, 1), "C") = 0 Then refCol = 3 Else refCol = 2 End If productNum = productNum & Sheet3.Cells(col - 1, refCol) Rem 取铺货件数,如果<=0,就跳过,否则插入一维表 If Sheet1.Cells(row, col) > 0 Then Sheet2.Cells(targetRow, 1) = productNum & "," & Sheet1.Cells(row, col) targetRow = targetRow + 1 End If Next End Ifline: Next If targetRow = 1 Then Worksheets(1).Activate MsgBox "二维表没有数据!" Else Sheet2.Range("D4").Value = targetRow - 1 Worksheets(2).Activate MsgBox "生成成功!" End If End Sub
- EXCEL VBA 二维表转换成一维表
- EXCEL VBA 二维表转换成一维表
- Excel 二维表转换成一维表
- 实现行列二维到一维转换的EXCEL VBA代码
- excel vba 编码转换
- Excel VBA 类型转换函数
- Excel VBA 列名列标转换函数
- 利用Excel将二维表转换为一维表
- Excel VBA 宏 拆分Excel表
- 利用VBA编程实现从EXCEL表到AUTOCAD表转换
- 利用VBA编程实现从EXCEL表到AUTOCAD表转换
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- Excel VBA
- Excel VBA
- Excel VBA
- VisionMobile:Google博士和Android先生
- 关于Linux下minicom无法更改端口的解决办法
- python 学习手册 tips 第1,2,3章
- cocos2d-x 【小菜在学习】锚点与位置个人理解笔记
- mysql分表的3种方法
- EXCEL VBA 二维表转换成一维表
- HDU Big Event in HDU - 多重背包
- 【二叉树1】根据前序和中序遍历建立一棵二叉树
- android 从网络获取图片
- javascript五种函数调用方法,this代表
- web服务编程 REST与SOAP对比
- 正则表达式之字符
- 职位决定你的行为
- 关于ls命令下显示的total问题