20170728xlVba SSC_TODAY
Public Sub SSC_TODAY()
Dim strText As String
Dim Reg As Object, Mh As Object, OneMh As Object
Dim i As Long
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "http://cp.360.cn/ssccq?agent=700007", False
.Send
strText = .responsetext
End With
Set Reg = CreateObject("Vbscript.Regexp")
With Reg
.MultiLine = True
.Global = True
.Ignorecase = False
'20170728084">084</span><em class="code">77563</em>
.Pattern = "(\d{11})(?:.>)(\d{3})(?:</span><em class=""code"">)(\d{5})(?:</em>)"
Set Mh = .Execute(strText)
End With
With Sheets(1)
.Cells.ClearContents
.Range("A1:N1").Value = Array("大期号", "小期号", "万", "千", "百", "十", "个", "后三", "组01", "组23", "组45", "组67", "组89", "预测")
Index = 1
For Each OneMh In Mh
Index = Index + 1
.Cells(Index, 1).Value = "'" & OneMh.submatches(0)
.Cells(Index, 2).Value = OneMh.submatches(1)
op = OneMh.submatches(2)
For j = 1 To Len(op)
.Cells(Index, j + 2).Value = Mid(op, j, 1)
Next j
.Cells(Index, 8).Value = "'" & Right(op, 3)
Next OneMh
Sort2003 .UsedRange, 2
For i = 2 To Index
s = .Cells(i, 8).Text
gua = 0
For j = 9 To 13
keys = Replace(.Cells(1, j).Text, "组", "")
key1 = Left(keys, 1)
key2 = Right(keys, 1)
'Debug.Print s; " "; keys
If InStr(1, s, key1) = 0 And InStr(1, s, key2) = 0 Then
.Cells(i, j).Value = "中"
Else
.Cells(i, j).Value = "挂"
gua = gua + 1
End If
Next j
If gua >= 3 Then
.Cells(i, 14).Value = "挂"
Else
.Cells(i, 14).Value = "中"
End If
Next i
With .UsedRange
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
SetBorders .UsedRange
Dim uRng As Range
Dim OneCell As Range
For Each OneCell In .UsedRange.Cells
If OneCell.Text = "中" Then
If uRng Is Nothing Then
Set uRng = OneCell
Else
Set uRng = Union(uRng, OneCell)
End If
End If
Next OneCell
FillRed uRng
End With
Set Reg = Nothing
Set Mh = Nothing
Set uRng = Nothing
End Sub
Sub Sort2003(ByVal RngWithTitle As Range, Optional SortColumnNo As Long = 1)
With RngWithTitle
.Sort key1:=RngWithTitle.Cells(1, SortColumnNo), Order1:=xlAscending, Header:=xlYes, _
MatchCase:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin
End With
End Sub
Sub SetBorders(ByVal Rng As Range)
With Rng.Borders
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
End Sub
Sub FillRed(ByVal Rng As Range)
With Rng.Font
.ColorIndex = 3
.Bold = True
End With
End Sub
20170728xlVba SSC_TODAY的更多相关文章
- 20170728xlVba还是这个混蛋
Public Sub Main22() If Now() >= #1/1/2018# Then Exit Sub Dim strText As String Dim Reg As Object, ...
- 20170728xlVba SSC_LastTwoDays
Public Sub SSCLastTwoDays() Dim strText As String Dim Reg As Object, Mh As Object, OneMh As Object D ...
- 20170728xlVba简单的匹配
Sub MatchData() Dim i As Long, EndRow As Long, Key As String Dim Rng As Range Dim Dic As Object Set ...
- 20170728xlVBA改转置一例
Sub 导出() Dim Sht As Worksheet, ShtName As String Dim NextRow As Long, NextRow2 As Long Dim iRow As L ...
随机推荐
- uva1330 在一个大的矩阵中寻找面积最大的子矩阵
大白书 P50页 #include <algorithm> #include <cstdio> using namespace std; ; int ma[maxn][maxn ...
- python+Django框架运用(三)
Django模型 模式指的是根据数据库中数据表的结构来创建出来的class,每一张表到Python中就是一个 class,表中的每一个列,到Python中就是class的一个属性. 在模型中可以完成对 ...
- Ignite初探
Guava是一个很方便的本地缓存工具,但是在多节点处理的过程中,本地缓存无法满足数据一致性的问题.分布式缓存Ignite很好的解决了数据一致性,可靠性,事务性等方面的问题. Ignite支持分区方式和 ...
- Java SE 基础知识(String,Array)
String 类: 1. 对于String对象的相等性判断来说,请使用equals()方法,而不是==.String的equals()是判断当前字符串与传进来的字符串的内容是否一致. 2. Strin ...
- svn忽略目录,svn忽略app目录add toignore list,避免每次更新很多app的内容下来导出到本地很麻烦
svn忽略目录,svn忽略app目录add toignore list,避免每次更新很多app的内容下来导出到本地很麻烦 ------------------------------ 本人微信公众帐号 ...
- MySQL Crash Course #01# Chapter 1. 2 概念. Primary key
索引 database table schema Primary Key MySQL 书的第一章介绍一些基本的概念.理解数据库是掌握 MySQL 非常重要的一个部分. 第二章简单介绍了 MySQL 以 ...
- P4336 [SHOI2016]黑暗前的幻想乡
P4336 [SHOI2016]黑暗前的幻想乡 矩阵树定理(高斯消元+乘法逆元)+容斥 ans=总方案数 -(公司1未参加方案数 ∪ 公司2未参加方案数 ∪ 公司3未参加方案数 ∪ ...... ∪ ...
- 算法之路 level 01 problem set
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...
- 在Windows下搭建Android开发环境及遇到的问题
转载1:http://www.cnblogs.com/xdp-gacl/p/4322165.html 转载2:http://www.cnblogs.com/zoupeiyang/p/4034517.h ...
- 获取mips32机器的各数据类型的取值范围
一.背景: 使用的mips 32bit机器,32bit的vxworks操作系统(各机器带来的范围都不一样,与操作系统也有关联) 二.验证类型的范围: 2.1 unsigned long: void m ...