ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó±NA5¯È±i®æ¦¡¤@¦¸¦C¦L©óA4¯È±iª½±µ²£¥Í¤G¥÷ªí®æ

[µo°Ý] ¦p¦ó±NA5¯È±i®æ¦¡¤@¦¸¦C¦L©óA4¯È±iª½±µ²£¥Í¤G¥÷ªí®æ

¦U¦ì¤j¤j¦n¡G

  ¤p§Ì¤w§¹¦¨¤@¥÷ªí®æ¡AÅý¨Ï¥ÎªÌ¥i
¥Ñ¸ê®Æ®w¨ú¥X«ü©w¸ê®Æ¨Ã¶ñ¤Jªí®æ¤º
ªºÄæ¦ì¦ì¸m¡C
  ¦¹ªí®æ¹w³]¥i¦C¦L A5¯È±i¡A¥Ñ©ó
¶·¦L¦¹ªí®æ¬°¤@¦¡¤G¥÷¡A¤S¤½¥q¼v¦L¾÷
¥d§¨¤º¬° A4 ¯È±i¡F¥¿¦n²Å¦X A5 X 2= A4
¦ý¤p§Ì¤@ª½µLªk¥H¤@¥÷ªí®æª½±µ¦b A4 ¯È±i
¦L¥X¦¹ªí®æ¬°¤G¥÷¡C
  ¤p§Ì·Q½Ð°Ý¦¹±¡§Î¬O§_¶·²Å¦X¤U¦C¨º¤@
ºØ¤èªk¤~¥i逹¦¨¤W­zªº¶·¨D¡C

¤@¡B¥i¦bª©­±³]©w¨Ó逹¦¨¤@±iA4¯È
    ª½±µ¦L¦C¦¨¤G¥÷ªí®æ

¤G¡B¥ý§¹¦¨¦¹¥÷ªí®æ¦A½Æ»s¦Ü¥t¤@¤u§@ªí
    ³sÄò½Æ»s¤G¦¸¨Ó逹¦¨¦C¦L©óA4¯È±i
    逹¦¨¦L¦¨¤G¥÷ªí®æ

¤T¡B¥ý¦b¦¹¤u§@ªí»s¦¨¤G¥÷ªÅ¥Õªí®æ¡A±N
    ¥Ñ¸ê®Æ®w¨ú¥Xªº¸ê®Æ§¹¦¨¶ñ¤J¤@¥÷ªí®æ
    ¤º¡A¨Ã©ó¦C¦L®É¦A±N²Ä¤@¥÷ªí®æªº
    ¸ê®Æ¶ñ¤J¥t¤@¥÷ªÅ¥Õªºªí®æ¤º¦b¤@°_¦C¦L

¦p¬O²Ä¤@ºØ¤è¦¡®ÉÀ³¦p¦ó³]©w¡A
¦p¬O²Ä¤G¡B¤TºØ¤è¦¡®ÉVBA»yªk¤S¦p¦ó
³]­p©O¡H

ÁÂÁ¦U¦ì¤j¤j¡I

PRINTTEST.rar (11.11 KB)

¦U¦ì¤j¤j¦n¡G
  ¤p§Ì¤w§¹¦¨¤@¥÷ªí®æ¡AÅý¨Ï¥ÎªÌ¥i
¥Ñ¸ê®Æ®w¨ú¥X«ü©w¸ê®Æ¨Ã¶ñ¤Jªí®æ¤º
ªºÄæ¦ì¦ì¸m¡C
   ...
dechiuan999 µoªí©ó 2012-8-21 21:18


§Ú­è­è¦³·Q¨ì¤@ºØ¤è¦¡: (½Ð¨Ì²{ªp°u¤©­×§ï¤U­z¤º®e)
1. ±N­n¦C¦Lªº¨â­¶¸ê®Æ©ñ¦b¤@°_.
2. ³]©w­n¦C¦Lªº°Ï°ì½d³ò:

Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$C$5"

3. ³]©w¦C¦L¦¨ 1 ­¶°ª 1 ­¶¼e.

With Worksheets("Sheet1").PageSetup
    .Zoom = False
    .FitToPagesTall = 1
    .FitToPagesWide = 1
End With

4. ¦C¦L§¹½Ð°O±o±N¬ÛÃö°Ñ¼ÆÁÙ­ì

³o¼ËÀ³¸Ó´N¥i¥H¹F¨ì§A·Q­nªº®ÄªG¤F.

TOP

¦^´_ 2# luhpro


    ¤j¤j±z¦n¡G

ÁÂÁ±zªº»¡©ú
±z¦³´£¨ì
1. ±N­n¦C¦Lªº¨â­¶¸ê®Æ©ñ¦b¤@°_.
2. ³]©w­n¦C¦Lªº°Ï°ì½d³ò:
¨ä¹ê¤p§Ì¦b¤u§@ªí¤WÅã¥Ü¤G­Ó
­n¦C¦Lªºªí®æ¡A¬O¤£ª¾­n¦p¦ó±Æ°£¥t¤@­Ó
ªí®æ¡C´N¯à¦P®É¦b¤@±iA4¯Èª½±µ¦C
¦L¥X¤G¥÷ªí®æ¥X¨Ó¡CÅý¨Ï¥ÎªÌ¤]¤£·|
·Pı¦³¦h¥X¤@¥÷ªí®æ¡C

¤p§Ì¬Q¤Ñ¥ý¥H·s¼W¤@¤u§@ªí¡A
¨Ã¦b¸Óªí¤W¼W³]¤G¥÷ªí®æ¡C
µ¥¨ì¸Ó¨Ï¥ÎªÌ­n¶ñªºªí®æ
§¹¦¨¶ñ¼g¤§«á¡A¦A³]©w¤@«ö¶s
Åý¨Ï¥ÎªÌ¦C¦L¡A¦P®É¤]±N¨Ï¥ÎªÌªº
¶ñ¼gªí®æ¸ê®Æ¦AÂà¼g¦Ü·s¼Wªº¤G¥÷ªí®æ¤º
§¹¦¨¦C¦L¤u§@¡C

¤p§Ì¬O§Æ±æ¯à´î¤Ö¤W­zªº¤@¨Ç¨BÆJ¡C

·P®¦¤j¤j¡I

TOP

¦^´_ 3# dechiuan999
¨Ì1#ªþÀÉ ²Ä¤@­Óªí®æ©Ò¼g, ¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Dim Sh As Worksheet, Rng As Range
  3. Sub «ö¶s()       '«ö¯Ã«ü©wªºµ{¦¡
  4.     Dim ¦L¦C As String
  5.     Set Sh = ActiveSheet
  6.     Set Rng = Sh.[A1:G20]                            'ªí®æ½d³ò
  7.     Do
  8.         ¦L¦C = InputBox("¦L¦Cªí®æ:  ½Ð¿é¤J  1 ©Î 2 ", "¦L¦Cªí®æ")
  9.     Loop Until ¦L¦C = "1" Or ¦L¦C = "2" Or ¦L¦C = ""
  10.     If ¦L¦C = "1" Then
  11.         With Sh
  12.             .PageSetup.PrintArea = Rng.Address
  13.             .PageSetup.FitToPagesTall = 1
  14.             .PageSetup.FitToPagesWide = 1
  15.             .PrintOut
  16.         End With
  17.     ElseIf ¦L¦C = "2" Then
  18.         ¤G±iªí®æ
  19.     End If
  20. End Sub
  21. Private Sub ¤G±iªí®æ()
  22.     Dim R As Range, ActionShape As String, i As Integer
  23.     With Sh
  24.         ActionShape = .Shapes(Application.Caller).Name  '°õ¦æ¦¹µ{¦¡ªº«ö¶s¦WºÙ
  25.         '---¦¹¦æµ{¦¡½X «öF5 ©Î F8 ·|¦³¿ù»~  »Ý¬O¦b¤u§@ªí«ö¤U [«ö¶s] °õ¦æ ----
  26.         Application.ScreenUpdating = False
  27.         Rng.Copy Rng.Offset(Rng.Rows.Count)             '½Æ»sªí®æ
  28.         For Each R In Rng.Rows            '
  29.             R.Offset(20).RowHeight = R.RowHeight        '½Æ»sªí®æ:½Õ¾ã¦C°ª»Pªí®æ ¬Û¦P
  30.         Next
  31.         .PageSetup.PrintArea = .Range(Rng, Rng.Offset(Rng.Rows.Count)).Address
  32.                                                         '³]©w¦L¦C½d³ò
  33.         .PageSetup.FitToPagesTall = 1
  34.         .PageSetup.FitToPagesWide = 1
  35.         '.PrintPreview                                  '¦L¦C¹wÄý
  36.         .PrintOut                                       '¦L¦C
  37.         For i = .Shapes.Count To 2 Step -1              '§R°£¹Ï¤ù:¤ù¥Ñ«á§R°£¨ì²Ä2­Ó
  38.             If .Shapes(i).Name <> ActionShape Then .Shapes(i).Delete
  39.                                                         '±Æ°£Shape¬O«ü©wµ{¦¡«ö¯ÃªºShape
  40.         Next
  41.         Rng.Offset(Rng.Rows.Count).Clear                '²M°£: ½Æ»sªí®æ
  42.         Rng.Offset(Rng.Rows.Count).RowHeight = .Cells(.Rows.Count).RowHeight
  43.                                                         '¦^´_¦C°ª
  44.         .PageSetup.PrintArea = Rng.Address              '¦^´_¦L¦C½d³ò
  45.         Application.ScreenUpdating = True
  46.     End With
  47. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE


    ª©¥D¤j¤j±z¦n¡G

   ·PÁ±zªº¬Û§U¡A¦¹¤èªk¹ê¦b
¤Ó§¹¬ü¡C°ß¿W¦³¤@»yªk¤p§Ì¤]
¤Wºô§ä¤F«Ü¦h½d¨Ò»¡©ú
Application.Caller¤§¥Îªk
«o¤´µLªk»â·|¡Aºô¸ô¤Wªº½d¨Ò
¤]¤£ª¾¦p¦ó°õ¦æ¡C
·Q ½Ðª©¥D¤j¤j¯à¶}¥Ü«üÂI°g¬z
application caller¤§À³¥Î
¤Î¨ä§t·N¬°¦ó¡H

ª©¥D»yªk¦p¤U¡G
ActionShape = .Shapes(Application.Caller).Name  '°õ¦æ¦¹µ{¦¡ªº«ö¶s¦WºÙ

ºô¸ô¤Wªº½d¨Ò¡G
Function Sheetname()
       Application.Volatile
       Sheetname = Application.Caller.Parent.Name
End Function

Function Test()

      Application.Volatile
      ' Returns the cell one column to the left of the active cell. Note
      ' that the active cell is not necessarily the cell that is calling
      ' the function.
      Test = ActiveCell.Offset(0, -1).Value
   End Function

change it to the following:

   Function Test()
      Application.Volatile
      ' Returns the cell one column to the left of the cell that is
      ' actually calling the function.
      Test = Application.Caller.Offset(0, -1).Value
   End Function

·P®¦¤j¤j¡I¡I

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-8-24 10:40 ½s¿è

¦^´_ 5# dechiuan999
Caller ÄÝ©Ê  ¶Ç¦^Ãö©ó©I¥s Visual Basic ªº¸ê°T ¡C
½Ð¦b¤u§@ªí¤W³]¤@ª«¥ó(¹Ï¤ù, «ö¶s...) ¥¨¶°«ü¦V Ex_Caller
¤@¯ë¼Ò²Õªºµ{¦¡½X
  1. Option Explicit
  2. Sub Ex_Caller()
  3. The_Caller Application.Caller
  4. End Sub
  5. Sub Auto_Open() '¦sÀÉ«á: ¶}Àɮɦ۰ʱҰʪº¥¨¶°
  6. The_Caller "Auto_Open"
  7. End Sub
  8. Sub Auto_CLOSE() 'ÃöÀɮɦ۰ʱҰʪº¥¨¶°
  9. The_Caller "Auto_CLOSE"
  10. End Sub
  11. Function Ex() As String '¤u§@ªí¤W ¿é¤J¨ç¼Æ =Ex()
  12. Application.Volatile '(Ex") = False
  13. Ex = "Ex_Function"
  14. The_Caller "Function Ex()"
  15. End Function
  16. Sub The_Caller(Macro As String)
  17. Dim v As String
  18. Select Case TypeName(Application.Caller)
  19. Case "Range"
  20. '¦b³æ¤@Àx¦s®æ¤¤¿é¤Jªº¦Û­q¨ç¼Æ
  21. v = Application.Caller.Address
  22. Case "String" '--¶Ç¦^¥G¥s¦¹¥¨¶°ªºª«¦WºÙ ---
  23. 'Auto_Open¡BAuto_Close¡BAuto_Activate ©Î Auto_Deactivate ¥¨¶°
  24. v = Application.Caller
  25. Case "Error"
  26. '[¤u¨ã] ¥\¯àªí¤¤ªº [¥¨¶°] ¹ï¸Ü¤è¶ô¡A©Î¤W­z¤§¥~ªº¨ä¥L©I¥sªÌ #REF! ¿ù»~­È
  27. v = "Error"
  28. Case Else
  29. v = "unknown"
  30. End Select
  31. MsgBox Macro & Chr(10) & "Caller = " & v
  32. End Sub
½Æ»s¥N½X

TOP

¦^´_ 6# GBKEE


    ·PÁª©¥D¤j¤j
´£¨Ñ½Ñ¦h½d¨Ò¡C
  ¤p§Ì·|§Q¥Î¶g¥½ªº®É¶¡
¥Î¤ß¾Ç²ß¬ÛÃö½d¨ÒªºÅܤơC

´N·P¤ß¡I¡I
·P®¦¤j¤j¡C

TOP

        ÀR«ä¦Û¦b : ¬Ý§O¤H¤£¶¶²´¡A¬O¦Û¤v­×¾i¤£°÷¡C
ªð¦^¦Cªí ¤W¤@¥DÃD