EXCEL自动更新列表,如何只把最新的5行数据提取出来?该用什么函数?
这是代码,求修改:PrivateSubCommandButton1_Click()Range("A3:AC3500").Cleark3dshijihao="http://...
这是代码,求修改:
Private Sub CommandButton1_Click()
Range("A3:AC3500").Clear
k3dshijihao = "http://www.17500.cn/getData/ssq.TXT"
d3s = "WData3D_All"
Cells(2, 1) = "开奖期号"
Cells(2, 2) = "开奖日期"
Cells(2, 3) = "红"
Cells(2, 4) = "号"
Cells(2, 5) = " "
Cells(2, 6) = " "
Cells(2, 7) = " "
Cells(2, 8) = " "
Cells(2, 9) = "蓝"
Cells(2, 10) = "红"
Cells(2, 11) = "号"
Cells(2, 12) = "出"
Cells(2, 13) = "球"
Cells(2, 14) = "顺"
Cells(2, 15) = "序"
Cells(2, 16) = "投注总额"
Cells(2, 17) = "奖池金额"
Cells(2, 18) = "一等注数"
Cells(2, 19) = "一等金额"
Cells(2, 20) = "二等注数"
Cells(2, 21) = "二等金额"
Cells(2, 22) = "三等注数"
Cells(2, 23) = "金额"
Cells(2, 24) = "四等注数"
Cells(2, 25) = "金额"
Cells(2, 26) = "五等注数"
Cells(2, 27) = "金额"
Cells(2, 28) = "六等注数"
Cells(2, 29) = "金额"
cz = k3dshijihao: czmc = d3s
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & cz, Destination:=Range("A3"))
.Name = czmc
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Range("A" & (Application.Count(Range("a1:a3000")))).Select
End
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub 展开
Private Sub CommandButton1_Click()
Range("A3:AC3500").Clear
k3dshijihao = "http://www.17500.cn/getData/ssq.TXT"
d3s = "WData3D_All"
Cells(2, 1) = "开奖期号"
Cells(2, 2) = "开奖日期"
Cells(2, 3) = "红"
Cells(2, 4) = "号"
Cells(2, 5) = " "
Cells(2, 6) = " "
Cells(2, 7) = " "
Cells(2, 8) = " "
Cells(2, 9) = "蓝"
Cells(2, 10) = "红"
Cells(2, 11) = "号"
Cells(2, 12) = "出"
Cells(2, 13) = "球"
Cells(2, 14) = "顺"
Cells(2, 15) = "序"
Cells(2, 16) = "投注总额"
Cells(2, 17) = "奖池金额"
Cells(2, 18) = "一等注数"
Cells(2, 19) = "一等金额"
Cells(2, 20) = "二等注数"
Cells(2, 21) = "二等金额"
Cells(2, 22) = "三等注数"
Cells(2, 23) = "金额"
Cells(2, 24) = "四等注数"
Cells(2, 25) = "金额"
Cells(2, 26) = "五等注数"
Cells(2, 27) = "金额"
Cells(2, 28) = "六等注数"
Cells(2, 29) = "金额"
cz = k3dshijihao: czmc = d3s
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & cz, Destination:=Range("A3"))
.Name = czmc
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Range("A" & (Application.Count(Range("a1:a3000")))).Select
End
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub 展开
5个回答
展开全部
'可在代码中调用,也可直接执行
Sub 最新的5行数据提取()
Cells(Cells.Rows.Count, 1).End(xlUp).Offset(-5, 0).Select
Rows("3:" & Selection.Row).Delete 'Select
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在End With后面插入代码
arrrr = Cells([a3500].End(3).Row - 4, 1).Resize(5, 29)
Range("A3:AC3500").Clear
Cells(3, 1).Resize(5, 29) = arrrr
追问
找了两天了终于找到真正的高手了.!谢谢加谢谢!
追答
不用客气
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
运用到这些地方来了,也是蛮拼的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如何修改字体,行高,列宽,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
vlookup
vlookup
vlookup
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询