7个回答
展开全部
能写成这样,还有什么完不成?
部分代码:
Dim xlsheet As Excel.Worksheet
Dim xlbook As Excel.Workbook
ll = ListBox1.ListIndex
Set xlbook = ThisWorkbook.Application.Workbooks.Add(ListBox1.List(ll))
Set xlsheet = xlbook.Worksheets(1)
T11.Text = xlsheet.Range(T1.Text)
xlbook.Close SaveChanges:=False
xlsheet.Copy ThisWorkbook.Sheets(1)
xlbook.Close SaveChanges:=False
若不明白之处,可联系848555411@qq.com
展开全部
Sub 导入数据()
Dim Wb As Workbook
Dim Temp As String
Application.ScreenUpdating = False
Temp = ThisWorkbook.Path & "\aaaaaaa.xls" '这个是你要导入的表文件路径
Set Wb = GetObject(Temp)
With Wb.Sheets("sheet1").Range("A2").CurrentRegion
Range("A2").Resize(.Rows.Count, .Columns.Count) = .Value
Wb.Close False
End With
Set Wb = Nothing
Application.ScreenUpdating = True
End Sub
Dim Wb As Workbook
Dim Temp As String
Application.ScreenUpdating = False
Temp = ThisWorkbook.Path & "\aaaaaaa.xls" '这个是你要导入的表文件路径
Set Wb = GetObject(Temp)
With Wb.Sheets("sheet1").Range("A2").CurrentRegion
Range("A2").Resize(.Rows.Count, .Columns.Count) = .Value
Wb.Close False
End With
Set Wb = Nothing
Application.ScreenUpdating = True
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub 合并工作簿()
Dim FilesToOpen
Dim x As Integer
On Error GoTo ErrHandler
Application.ScreenUpdating = False
FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")
If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If
x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend
ExitHandler:
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub
Dim FilesToOpen
Dim x As Integer
On Error GoTo ErrHandler
Application.ScreenUpdating = False
FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")
If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If
x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open Filename:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend
ExitHandler:
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
未说明清楚。两个表格是怎样表格?是相同表格(复制粘贴即可)?还是总分关系,最好能附上附件。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
VBA很容易实现
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询