Option Explicit
Dim filepath As String
Dim wb As Workbook
Sub import()
Dim i As Integer
Dim sname As String
filepath = Application.GetOpenFilename()
Set wb = GetObject(filepath)
For i = 3 To wb.Sheets.Count
sname = wb.Sheets(i).Name
Cells(i, 1) = sname
Cells(i, 2) = Split(sname, ".")
Next
MsgBox ("目录导入完成。")
End Sub
Sub data()
Dim st As Range
Dim x As Integer
Dim y As Integer
Dim m As Integer
Dim i As Integer
Dim j As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim cellname As String
Dim stname As String
a = Range("F3")
b = Range("F4")
For c = a To b
cellname = wb.Sheets(c).Range("Title")
stname = "cell" & Mid(cellname, Len(cellname) - 8, 1) & "-" & Right(cellname, 1)
Application.DisplayAlerts = False
wb.Sheets(c).UsedRange.Copy Sheets(stname).Range("A1")
x = wb.Sheets(c).Range("myrow2").Row
y = wb.Sheets(c).Range("myrow3").Row
m = y - x + 1 - 7
If m = 11 Then
For i = 1 To 2
Sheets(stname).Rows(x - 4).Insert
Next i
For j = 1 To 3
Sheets(stname).Rows(y - 2).Insert
Next j
ElseIf m = 12 Then
Sheets(stname).Rows(x - 4).Insert
For j = 1 To 2
Sheets(stname).Rows(y - 3).Insert
Next j
ElseIf m = 13 Then
Sheets(stname).Rows(y - 4).Insert
End If
Next c
wb.Close
MsgBox ("数据导入完成。")
End Sub