标签:int pre criteria data his book active off vba
Sub shishi() Dim rng As Range For Each rng In Range("b2:b20") If rng.Offset(0, -1) = "男" Then rng = "先生" Else: rng = "女士" End If Next End Sub
Sub shishi() Dim i As Integer For i = 1 To Range("a65536").End(xlUp).Row If Sheet1.Range("d" & i).Value = "一车间" Then Sheet1.Range("d" &i).EntireRow.CopySheet2.Range("a"&Range("a65536").End(xlUp).Row) End If Next End Sub
Sub aaa() Dim sht As Worksheet Dim i As Integer For i = 2 To Sheet1.Range("a65536").End(xlUp).Row Sheet1.Range("d" & i).EntireRow.Copy Sheets(Sheet1.Range("d" & i).Value).Range("a" & Sheets(Sheet1.Range("d" & i).Value).Range("a65536").End(xlUp).Row + 1) Next For Each sht In Worksheets sht.Copy ActiveWorkbook.SaveAs Filename:="d:\data\" & sht.Name & ".xlsx" ActiveWorkbook.Close Next End Sub
Sub 宏1() Dim sht As Worksheet For Each sht In Sheets(Array("一车间", "二车间", "财务部", "销售1部", "经理室", "人力资源部", "销售2部", "技改办")) Sheet1.Range("a1").Resize.AutoFilter Field:=4, Criteria1:=sht.Name Sheet1.Range("a1").Resize(Sheet1.Range("a65536").End(xlUp).Row, 6).Copy Sheets(sht.Name).Range("a1") sht.Copy ActiveWorkbook.SaveAs Filename:="d:\data\" & sht.Name & ".xlsx" ActiveWorkbook.Close Next End Sub
标签:int pre criteria data his book active off vba
原文地址:https://www.cnblogs.com/yigeduanpian/p/10041736.html