mpjx.net
当前位置:首页 >> EXCEL VBA按4个条件组合出结果 >>

EXCEL VBA按4个条件组合出结果

Sub s() Dim arr, b(10, 1 To 4), rg As Range Set rg = [a39:j1308] rg.ClearContents arr = [f10:f17] For i = 1 To 4 b(0, i) = Len(arr(i * 2 - 1, 1)) For j = 1 To b(0, i) b(j, i) = Mid(arr(i * 2 - 1, 1), j, 1) Next Next For i = 1 T...

Dim arr, brr(1 To 6), k, r, ccSub s() arr = [k1].Resize(Cells(Rows.Count, "K").End(3).Row) k = UBound(arr) r = 1 p 1, 1End SubSub p(c, i) For j = i To k - cc + c brr(c) = arr(j, 1) If c = cc Then Cells(r, 13).Resize(, cc) = brr...

12345678910111213141516171819Sub s() a = [b6] b = [b8] n = Len(a) ReDim arr(1 To n) For i = 1 To n arr(i) = Mid(a, i, 1) & Mid(b, i, 1) Next For i = 1 To n - 1 For j = n - 1 To i Step -1 If arr(j) > arr(j + 1) Then t = arr(j) a...

写个Udf就解决了

数据量不多的话没必要通过字典过桥,直接借用一个空的工作表作为过桥即可,我是通过SHEET3 代码如下 Sub 父子关系1() On Error Resume Next Sheets("Sheet3").Cells.Select Selection.ListObject.QueryTable.Delete Sheets("Sheet3").Select Wi...

亲,收作业吧,已经合并了,IF也改了 建议您以后写代码分一下级,自己读起来也轻松些 Sub b()For k = 3 To 238 For n = 1 To 17 If Sheets("授课数据表").Range("c" & k) = Sheets(n).Name And _ Sheets("授课数据表").Range("f" & k) = "一" An...

Sub s() Dim arr, b(10, 1 To 4), rg As Range arr = [b3:b6] For i = 1 To 4 b(0, i) = Len(arr(i, 1)) For j = 1 To b(0, i) b(j, i) = Mid(arr(i, 1), j, 1) Next Next Set rg = [a39:j1308] For i = 1 To b(0, 1): For j = 1 To b(0, 2): Fo...

Sub s() a = [b6] b = [b8] n = Len(a) ReDim arr(1 To n) For i = 1 To n arr(i) = Mid(a, i, 1) & Mid(b, i, 1) Next For i = 1 To n - 1 For j = n - 1 To i Step -1 If arr(j) > arr(j + 1) Then t = arr(j) arr(j) = arr(j + 1) arr(j + 1)...

Sub 随机14位数() Dim A(1 To 14), B(1 To 14) As String Dim S As String Dim i, j As Integer Dim Dic As Object '填充数组A,先填1、2、3,4个*,其余的随机填充1、2、3【保证1、2、3至少出现一次,保证只有4个*】 '随机打乱数组A '判断结果是...

Sub suiji() s = Array(1, 2, 3, 4) For i = 0 To 3 r = Int(Rnd() * 4) t = s(i) s(i) = s(r) s(r) = t Next shuchu = "" For i = 0 To 3 shuchu = shuchu & s(i) & "," Next shuchu = Left(shuchu, Len(shuchu) - 1) Range("A" & Range("A6553...

网站首页 | 网站地图
All rights reserved Powered by www.mpjx.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com