- ©«¤l
- 262
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 280
- ÂI¦W
- 16
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- HK
- µù¥U®É¶¡
- 2015-8-11
- ³Ì«áµn¿ý
- 2024-10-26
|
è¤~¸Õ¤F¤@¤U¦³¤í,²{×¥¿¦p¤U:
Sub zz()
Application.ScreenUpdating = 0
Application.DisplayAlerts = 0
Dim usedH, hd As Range, fn As Range, pd As Range
Set hd = Range(±zªº¶ÀY)
Set fn = Range(±zªº¶§À)
Set pd = ActiveSheet.UsedRange
'usedH ±N©Ò»Ý¦C¦L°ª«×²Ö¥[
For Each r In hd.Rows
usedH = usedH + r.RowHeight
Next
For Each r In fn.Rows
usedH = usedH + r.RowHeight
Next
'avh ¤@¶¯à¦C¦L°ª«×
avh = 710 - Int(usedH) '¦¹³B§Ú¤£À´¦Û°Êpºâ, ½Ð¦Ñ®v«ü¾É
'bodyS ¤º®e¶}©l¦æ, bodyE ¤º®eµ²§À¦æ
bodyS = hd.Rows.Count + 1
bodyE = pd.Rows.Count - fn.Rows.Count
zc = pd.Columns.Count
Sheets.Copy
Range(Cells(bodyS, 1), Cells([a65536].End(3).Row, 1)).EntireRow.Delete
'pr1 ¦C¦L¤º®e²Ä¤@¦æ
pr1 = bodyS
For i = bodyS To bodyE
n = n + pd.Rows(i).RowHeight
If n >= avh Then
Range(pd.Cells(pr1, 1), pd.Cells(i, zc)).Copy Range("a" & [a65536].End(3).Row + 1)
fn.Copy Range("a" & [a65536].End(3).Row + 1)
pr1 = i + 1
n = 0
ActiveSheet.PrintOut Copies:=1
Range(Cells(bodyS, 1), Cells([a65536].End(3).Row, 1)).EntireRow.Delete
End If
Next
If n Then
Range(pd.Cells(pr1, 1), pd.Cells(i, zc)).Copy Range("a" & [a65536].End(3).Row + 1)
fn.Copy Range("a" & [a65536].End(3).Row + 1)
ActiveSheet.PrintOut Copies:=1
Range(Cells(bodyS, 1), Cells([a65536].End(3).Row, 1)).EntireRow.Delete
End If
ActiveWorkbook.Close 0
Application.ScreenUpdating = 1
Application.DisplayAlerts = 1
End Sub |
|