nsjd.net
当前位置:首页 >> 怎么用VBA将ExCEl里的数据提取到新的默认命名的表... >>

怎么用VBA将ExCEl里的数据提取到新的默认命名的表...

数据不多,用 for next 循环 否则用vba数组方式

可以使用“数据透视表“-“显示报表筛选页”功能实现 先插入一个透视表 把需要命名的字段拖到“筛驯处 【分析】菜单-【显示报表筛选页】 具体如图所示:

下面的代码可以把所有的Sheet都生成一个新文件,把不要的删除就好了: Sub M() For Each sh In Sheets sh.Copy ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & sh.Name & "-" & Format(Now, "YYYYMMDD") ActiveWorkbook.Close Next End Sub

可以使用如下代码: Sub 按钮1_Click() ActiveSheet.Copy after:=Sheets(Sheets.Count) ActiveSheet.Name = Day(Date) ActiveSheet.UsedRange = ActiveSheet.UsedRange.Value End Sub

Sub 宏1() Workbooks.Add ActiveWorkbook.SaveAs Filename:="C:\test.xlsx", FileFormat:=xlOpenXMLWorkbook ActiveWindow.Close End Sub

Dim xSht1 As Worksheet Dim xSht2 As Worksheet Set xSht1 = Sheets("sheet1") Set xSht2 = Sheets("sheet2") For i = 1 To 45 xSht2.Cells(1, i) = xSht1.Cells(i + 3, 3) 'sheet1表中的C4-C48,放到sheet2的第一行。 Next i

Public Sub 痒痒养羊() For i = 1 To 3 For j = 2 To 4 If Left(Sheet2.Cells(1, i), 1) = Sheet1.Cells(j, 1) Then k = Sheet2.Cells(1, i).End(xlDown).Row For m = 2 To k Sheet1.Cells(j, m) = Sheet2.Cells(m, i) Next End If Next Next En...

网页链接 网盘,7天有效,随便写了一个,没数据表就没测试~ Private Sub CommandButton1_Click() On Error Resume Next Dim ws As Worksheet, existed As Boolean, wb, bm, a, b, c bm = Cells(1, 5): b = 4 existed = False For Each ws In Wor...

你的问题用数据库方式才好处理。 如果 用数据库软件,建议你的表格填写不要合并单元格的方式填写。

Sub 打开excel表格()Dim myPath$, myFile$, AK As WorkbookDim n As IntegerDim a As Integera = 2b = 1'Application.ScreenUpdating = False '冻结屏幕,以防屏幕抖动myPath = "d:\test\" '把文件路径定义给变量myFile = Dir(myPath & "*.xls")...

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