excel把行或列独立出来
发布网友
发布时间:2022-08-15 07:51
我来回答
共5个回答
热心网友
时间:2023-09-14 04:31
'大姐,要用宏啊!复制以下宏代码,运行即可
Sub rows2excels()
f "Sheet1" '左边双引号之间改为你的工作簿名,比如Sheet1
End Sub
Private Function f(st As String) As Boolean
Dim i, j As Integer
Dim wb As String
wb = ActiveWorkbook.Name
j = ActiveSheet.UsedRange.Rows.Count
For i = 1 To j
Sheets.Add.Name = "行" & i
Sheets(st).Rows(i).Copy
Sheets(("行" & i)).Select
Rows("1:1").Select
ActiveSheet.Paste
Next i
Application.DisplayAlerts = False
Dim XSheet As Worksheet
For Each XSheet In Workbooks(wb).Sheets
XSheet.Copy
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & ActiveSheet.Name & ".xls"
ActiveWindow.Close
Next
Application.ScreenUpdating = True
Workbooks(wb).Activate
For i = 1 To j
Sheets(("行" & i)).Delete
Next i
Kill ThisWorkbook.Path & "\" & st & ".xls"
End Function
'如要导出列,只需将代码中的“Rows”都替换为“Columns”,“行”改为“列”即可。
参考资料:Excel
热心网友
时间:2023-09-14 04:32
Sub yueliang_914()
For i = 1 To 8
If Cells(i, 1) <> "" Then
Sheets("Sheet1").Select
Rows(i).Copy
Sheets.Add.Name = Cells(i, 1)
Sheets(1).Activate
Range("A1").Select
ActiveSheet.Paste
Sheets(1).Move
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & ActiveSheet.Name & ".xls", CreateBackup:=False
ActiveWindow.Close
End If
Next
End Sub
热心网友
时间:2023-09-14 04:32
只能把一行的内容复制到一个新的工作表中,再保存。
热心网友
时间:2023-09-14 04:33
你的意思是自动实现对吧,写个宏就能实现了。
现在不方便,晚上回去给你搞定
热心网友
时间:2023-09-14 04:33
我也想知道哦,(除了复制、册子除!1但是我想不出更好的办法)