- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 15
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-12
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2013-11-15 22:30 ½s¿è
¦^´_ 1# oao
¥H¤Uµ{¦¡¤£¥i«½Æ°õ¦æ(·|µo¥Í SheetName «½Æªº¿ù»~), ³o¸Ì¨S¦³³]©w«ö¶s©ÎIJµo¦¹µ{§Çªº¾÷¨î, «Øij¥H³æ³¡°õ¦æ¨ÓÆ[¹î¹B§@±¡§Î.- Sub CrtSheet()
- Dim lRow&
- Dim sStr$
- Dim rSou As Range, rTar As Range
-
- With Workbooks.Open(ThisWorkbook.Path & "\³øªí½d¥».xls")
- Set rSou = .Sheets("Sheet1").[A1] ' ¨Ó·½
- End With
- Set rTar = ThisWorkbook.Sheets("Sheet1").[A1] ' ¥Øªº
-
- With rTar.Parent ' ¥u Copy 1 Ó Sheet, ¤§«á§ï¥H¦¹ Sheet °µ¥Àª©
- lRow = 2
- sStr = .Cells(lRow, 1) & "-" & .Cells(lRow, 2)
- rSou.Parent.Cells.Copy
- .Activate
- With ActiveWorkbook.Sheets.Add(After:=Worksheets(Worksheets.Count))
- With .[A1]
- .PasteSpecial
- .Select ' ÁקK¾ãÓ Sheet ³Q Select ªº±¡§Î
- End With
- .Name = sStr ' §ï¦W
- End With
- Application.DisplayAlerts = False ' Ãö±¼¨t²Î½T»{¬O§_©ñ±ó¤j¶q½Æ»s¸ê®Æªº¸ß°Ý°T®§
- rSou.Parent.Parent.Close False ' Ãö³¬½d¨ÒÀÉ®×
- Application.DisplayAlerts = True
-
- Set rSou = Sheets(sStr).[A1] ' ²£¥Í¨ä¥L Sheet
- lRow = 3
- Do While .Cells(lRow, 1) <> ""
- sStr = .Cells(lRow, 1) & "-" & .Cells(lRow, 2)
- rSou.Parent.Cells.Copy
- .Activate
- With ActiveWorkbook.Sheets.Add(After:=Worksheets(Worksheets.Count))
- With .[A1]
- .PasteSpecial
- .Select
- End With
- .Name = sStr
- End With
- lRow = lRow + 1
- Loop
- End With
- End Sub
½Æ»s¥N½X
¤£¦P¬¡¶Ã¯¶¡ªº¤u§@ªí½Æ»s.zip (9.15 KB)
' ¥H¤U¬O§Úªº¨Ï¥Î Excel VBA ´X¦~«áªºÆ[ÂI : (¥u¨Ï¥Î¹L Excel 2000 »P Excel 2003)
' Excel VBA ¤¤¥u¯à Dim Range ¤£¯à Dim Sheet (¹ïÀ³³æ¤@ Sheet, ¥B¾A¥Î¥ô¤@ Sheet), ¥u¯à Dim WorkSheet
' ³o¸Ì¤£±Ä¥Î WorkSheet, ¦]¬°Worksheet ¥u¯à¹ïÀ³¨ì¥Ø«eªº Sheet(Active ªº), ¤£½×§A¬A©·¤º©ñ¤°»òSheetName, ¬Æ¦Ü¨Æ¥ý Set ¹Lªº, ¥Î®É³£¬O«ü¦V¦P¤@Ó Sheet
' ¤]¤£±Ä¥Î Sheetx , ¦]¬°¤£½×¬O Sheet1, Sheet2, Sheet3... ³£«ÜÃø¥Î, Sheet1 ¥u¯à¥Î¦b Sheets(1), ¥Î¦b¨ä¥L Sheet ´N·|µo¥Í¿ù»~
' ©Ò¥H§Ú§ï¥Î Range.Parent ¨Ó«ü¦V¯S©wªº Sheet (¦n³B¬O¥un¤£¬O¥Î Work¬ÛÃö«ü¥O<WorkSheet...> ©Î¬O Select ´N¤£¥Î¨Æ¥ý Activate, ·Ó¼Ë¹ïÀ³¨ì¨Æ¥ý©w¸q¦nªº Sheet) |
|