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
展开
 我来答
weizhong1688
2017-09-06 · TA获得超过1245个赞
知道小有建树答主
回答量:1514
采纳率:61%
帮助的人:571万
展开全部

'可在代码中调用,也可直接执行

Sub 最新的5行数据提取()
    Cells(Cells.Rows.Count, 1).End(xlUp).Offset(-5, 0).Select
    Rows("3:" & Selection.Row).Delete    'Select
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
庆年工坊
2015-04-23 · 知道合伙人互联网行家
庆年工坊
知道合伙人互联网行家
采纳数:4232 获赞数:8922

向TA提问 私信TA
展开全部

在End With后面插入代码

arrrr = Cells([a3500].End(3).Row - 4, 1).Resize(5, 29)

Range("A3:AC3500").Clear

Cells(3, 1).Resize(5, 29) = arrrr
追问
找了两天了终于找到真正的高手了.!谢谢加谢谢!
追答
不用客气
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
锅是寂数仔
2015-04-23 · 超过35用户采纳过TA的回答
知道答主
回答量:135
采纳率:0%
帮助的人:56.6万
展开全部
运用到这些地方来了,也是蛮拼的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
zhming81
2021-06-28
知道答主
回答量:4
采纳率:0%
帮助的人:3489
展开全部
如何修改字体,行高,列宽,谢谢
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
344169037
2017-11-17 · TA获得超过7039个赞
知道大有可为答主
回答量:7168
采纳率:51%
帮助的人:783万
展开全部
vlookup
vlookup
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(3)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式