|
Option Explicit
Sub OpenFiles0()
Dim FileName As String
Dim bk As Workbook, Sht As Worksheet
Dim i As Integer
ChDir "F:\分笔数据"
FileName = Application.GetOpenFilename(filefilter:="workbooks(*.xls),*.xls") '.xls
If UCase(FileName) = "FALSE" Then
MsgBox "No file selected"
Exit Sub
End If
Set bk = Workbooks.Open(FileName)
bk.Sheets(1).Columns("A:E").Select
'Columns("A:E").Select
Selection.Copy
ActiveWindow.WindowState = xlNormal
Windows("Book1.xls").Activate
Range("A1").Select
ActiveSheet.Paste
Columns("A:E").Select
Range("E1").Activate
With Selection.Interior
.ColorIndex = 10
.Pattern = xlSolid
End With
bk.Activate
ActiveWindow.Close
End Sub
|
|