|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 导入表()
Dim Wb As Workbook
Dim Temp As String
Dim arr()
Dim i As Integer
Application.ScreenUpdating = False
Temp = ThisWorkbook.Path & "\原始数据.csv"
Set Wb = GetObject(Temp)
With Wb.Sheets("原始数据")
i = .Range("A1").CurrentRegion.Rows.Count
arr = .Range("A1:C" & i, "E1:E" & i).Value
Wb.Close False
End With
With ThisWorkbook.Sheets("表1")
.Range("A5").Resize(i, 4) = arr
.Range("A5").Resize(i, 1).Interior.ColorIndex = 24
.Range("A5").Resize(i, 1).Font.Name = "宋体"
.Range("A5").Resize(i, 1).Font.FontStyle = "Bold"
.Range("A5").Resize(i, 1).Font.Size = 12
.Range("A5").Resize(i, 1).HorizontalAlignment = xlHAlignCenter
.Range("B5").Resize(i, 3).Interior.ColorIndex = 43
.Range("B5").Resize(i, 3).Font.Name = "宋体"
.Range("B5").Resize(i, 3).Font.Size = 12
.Range("B5").Resize(i, 3).NumberFormat = "0.##"
End With
Set Wb = Nothing
Application.ScreenUpdating = True
End Sub
请查收~
|
|