![](/img/trans.png)
[英]How to split Excel sheet into multiple sheets based on a delimiter value?
[英]Split tables in one excel sheet to multiple other sheets based on continuity of data
您可以使用以下代碼將所有數據提取到不同的工作表
Sub spreaddate()
Dim totalrows As Integer
Dim countworksheet As Integer
Dim lastcopy As Integer
Dim Sht As Worksheet
Set Sht = ActiveSheet
countworksheet = 1
lastcopy = 2
totalrows = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To totalrows + 1
If Cells(i, 1).Value = "" Then
Sheets.Add.Name = countworksheet
Sht.Range("1:1").Copy Sheets(countworksheet).Cells(1, 1)
Sht.Range(lastcopy & ":" & i - 1).Copy Sheets(countworksheet).Cells(2, 1)
lastcopy = i + 1
countworksheet = countworksheet + 1
Sht.Activate
End If
Next i
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.