Sub yy() Dim brr(1 To 10000, 1 To 5) arr = .CurrentRegion Set regx = CreateObject("vbscript.regexp") regx.Pattern = "(\d{6})(.*省)(.*市)(.*)" '查找规则:4个子规则分别为 (6位数字) (X省) (X ...
Sub 在变量数组里计算符合条件字符的次数() For i = 1 To 20 If Cells(i, 1) = 1 Then arr = Cells(i, 2): Cells(i, 3) = arr Next n = Application.WorksheetFunction.CountIf(Columns("c:c"), "=1") Columns("c:c").ClearContents If n = 1 Then MsgBox "Wonderful" End Sub
Sub celia() For i = 1 To 2 If TimeValue("6:0:0") Cells(i, 1) And Cells(i, 1) TimeValue("7:0:0") Then MsgBox "ok" End If Next mycount = Application.WorksheetFunction.CountIfs(Columns("a:a"), "" TimeValue("6:0:0"), Columns("a:a"), "" TimeValue("7:0:0")) If mycount = 1 Then Ms ...
Function fncombine(myrange As Range) Dim strcombine As String Dim mycell As Range strcombine = "" For Each mycell In myrange If mycell.Value "" Then strcombine = strcombine mycell.Value "," End If Next strcombine = Left(strcombine, Len(strcombine) - 1) fncombine = strcombine End Func ...
Function fenli(rngmix As Range) For i = 1 To Len(rngmix.Value) mystr = Mid(rngmix.Value, i, 1) If IsNumeric(mystr) Then shuzi = shuzi mystr Else hanzi = hanzi mystr End If Next fenli = shuzi End Function