- ©«¤l
- 41
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 52
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows10
- ³nÅ骩¥»
- 2019
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-11-28
- ³Ì«áµn¿ý
- 2025-3-4

|
¥»©«³Ì«á¥Ñ edmondsforum ©ó 2020-6-30 01:08 ½s¿è
¦^´_ 13# n7822123
¸U¯ëªº·PÁÂÀs¤jªº¦^ÂÐ!!!!!
§Ú®Ú¾ÚÀs¤j´£¨Ñªºµ{¦¡½X¡A¨Ã¨Ì·Ó§A·N«ä§R°£§Ú¤£»Ýnªº³¡¤À
Sub test0624()
Dim xWeek As Integer
Dim xS As Worksheet
Dim xPH$
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual '°±¥Î¦Û°Ê«ºâ
xPH = ThisWorkbook.Path & "\"
On Error Resume Next
Set xS = Sheets("¶g³øªí")
xWeek = InputBox("½Ð¿é¤J²Ä""?""¶g")
xlsName = xPH & "²Ä1~" & xWeek & "¶g.xlsx"
'Bµ²ªG¡G¤@ÓÀɮסC(²Ä1~5¶g.XLSX) ¸ÌÀY¦³5Ó¤u§@ªí
With Workbooks.Add
sh_Cnt = .Sheets.Count
For sh = 1 To xWeek
xS.Activate
xS.Copy After:=Sheets(Sheets.Count)
Set xName = ActiveSheet
ActiveSheet.Name = "²Ä" & sh & "¶g"
With xName.UsedRange
.Calculate
.Value = .Value
End With
xName.Copy After:=.Sheets(.Sheets.Count) 'ª`Sheets«e±¦³ "." ¬O½Æ»s¨ì·sªº¬¡¶Ã¯
xName.Delete
Next sh
'§R°£ì¥»ªÅ¥Õªí®æ
For sh = 1 To sh_Cnt: .Sheets(1).Delete: Next
'¦sÀÉÃö³¬
.SaveAs xlsName
.Close True
End With
'Aµ²ªG¡G¤À§O²£¥Í5ÓÀɮסC( ²Ä1¶g.XLSX ²Ä2¶g.XLSX ²Ä3¶g.XLSX ²Ä4¶g.XLSX ²Ä5¶g.XLSX)
'³o¬q°ò¥»¤W¥i¤w»P¤W±¨º¬q¦X¨Ö¼g¡A¦ýµ{¦¡·|¤£¦n¾\Ū¡A¬°¤FÅý§A¬ÝÀ´¡A¥ý©î¶}¼gµ¹§A
'¦]¬°§Úªº¶g³øªíF1 »P G1 ³£¬O¿ù»~È¡AÀɦWªº¤é´Á§Ú¥ý¦Û¤v©w¸q¡A§A¦A¦Û¤vקï!
With Workbooks.Open(xlsName)
For sh = 1 To .Sheets.Count
Strday = .Sheets(sh).[F1] '§Aªº¤é´Á¶}©l¡A½Ð¦Û¦æ¥´¶}´ú¸Õ
Endday = .Sheets(sh).[H1] '§Aªº¤é´Áµ²§ô¡A½Ð¦Û¦æ¥´¶}´ú¸Õ
xlsName = "(" & .Sheets(sh).Name & ").xlsx"
xlsName = xPH & Strday & "~" & Endday & xlsName
.Sheets(sh).Copy
ActiveWorkbook.SaveAs xlsName
ActiveWorkbook.Close True
Next
.Close False
End With
Set xS = Nothing
Set xName = Nothing
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic '±Ò¥Î¦Û°Ê«ºâ
End Sub
§Úµo²{¦pªG§Ú쥻ªº³oÓ xS = Sheets("¶g³øªí") ¸Ì±ªºF1 ¸ò H1 ¬O¯Â¤å¦rªº¸Ü¡A
´N·|¦¨¥\¨Ì·Ó¤º®e¥O¦sÀɦW¡A¦ý¬O¸Ì±¬O¨ºÓ¦³¨ç¼Æ¤½¦¡ªº¸Ü
¥L´N·|¶]¥X¥s§Ú¥t¦sªºµøµ¡C¡C
P.S.§Ú¤w¸g§âIFS¨ç¼Æ§ï±¼¤F
§Ú¯à¸òÀs¤j½Ð±Ð»¡¡A§A¼gªº³oÓ¨ç¼Æ·N«ä
¬O¥ý®Ú¾Ú§Úªº±ø¥ó¥ý¦æ²£¥Í¤@ÓÀÉ®× ( xPH & "²Ä1~" & xWeek & "¶g.xlsx" )
¨Ã±q³oÓÀɮפÀ§O¥t¦s¥X¨Óªº¶Ü?
¦]¬°n¬O³o¼Ëªº¸Ü¡A·Ó²z»¡¤£·|¥X²{¥s§Ú¥t¦s§a¡A¥Nªí¥L§ä¤£¨ì¸Ì±ªºÈ©O?
§Ú¦b·Q·Ó¥H¤Uªº¨BÆJ¹Á¸Õ¼gµ{¦¡½X¡A¦ýµM«á´N¥d¦í¤F(¦b¤£¥ý¦æ²£¥Í xPH & "²Ä1~" & xWeek & "¶g.xlsx" ±¡ªp¤U)
°²³]§Ú¿é¤J3 ¡A
¥ý¦b쥻ªºÀÉ®× ²£¥Í¤TÓ¤u§@ªí¡A ²Ä¤@¶g¡B²Ä¤G¶g¡B²Ä¤T¶g
¤TÓ¤u§@ªí¸Ì±ªºÈ¤]³£Âà´«¦¨¯Â¤å¦r¤F
¦b§å¶q¥t¦s¡A¨Ã¤À§O®Ú¾Ú쥻Àɮתº ²Ä¤@¶g¡B²Ä¤G¶g¡B²Ä¤T¶gªºÀx¦s®æ §@¬°ÀɦW
¦b§R±¼ì¥»ªºÀɮתº¤TÓ¤u§@ªí¡C
Sub Create01() '§å¶q½Æ»s'
Dim xS As Worksheet, xName As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual '°±¥Î¦Û°Ê«ºâ
xPH$ = ThisWorkbook.Path & "\"
Set xS = Sheets("¶g³øªí")
xWeek% = InputBox("½Ð¿é¤J²Ä1¶g¡ã²Ä""?""¶g") 'Aµ²ªG¡G¤À§O²£¥Í5ÓÀɮסC( ²Ä1¶g.XLSX ²Ä2¶g.XLSX ²Ä3¶g.XLSX ²Ä4¶g.XLSX ²Ä5¶g.XLSX)
For i = 1 To xWeek
xS.Copy After:=Sheets(Sheets.Count)
Set xName = ActiveSheet
xName.Name = "²Ä" & i & "¶g"
With xName.UsedRange
.Calculate '«ºâ
.Value = .Value
End With
Strday = ActiveSheet.Range("F1")
xName.Copy
With ActiveWorkbook
.SaveAs xPH & Strday & i & "¶g.xlsx", CreateBackup:=False
.Close True
End With
xName.Delete
Set xName = Nothing
Next
Set xS = Nothing
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic '±Ò¥Î¦Û°Ê«ºâ
End Sub
¶]³o¼ËÁÙ¬O¿ù
½Ðì½Ì¤p§Ìªº·MÄø
§Ú¯uªº¤£·|§â³o¦ê
With Workbooks.Open(xlsName)
For sh = 1 To .Sheets.Count
Strday = .Sheets(sh).[F1] '§Aªº¤é´Á¶}©l¡A½Ð¦Û¦æ¥´¶}´ú¸Õ
Endday = .Sheets(sh).[H1] '§Aªº¤é´Áµ²§ô¡A½Ð¦Û¦æ¥´¶}´ú¸Õ
xlsName = "(" & .Sheets(sh).Name & ").xlsx"
xlsName = xPH & Strday & "~" & Endday & xlsName
.Sheets(sh).Copy
ActiveWorkbook.SaveAs xlsName
ActiveWorkbook.Close True
Next
.Close False
End With
±a¤J¶i¥h....
¦A«ô°UÀs¤jÀ˵ø¤F
TEST-0630.zip (331.38 KB)
|
|