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

¦r¤¸»PÅÜ¼Æ ­n¦p¦ó¦ê±µ

¦r¤¸»PÅÜ¼Æ ­n¦p¦ó¦ê±µ

¦U¦ì¤j¤j¦n

¤p§Ì¤@ª½·d¤£²M·¡ªº¦a¤è

¦r¤¸»PÅÜ¼Æ ­n¦p¦ó¤~¯à¥¿½T¦ê±µ©O?

ÅÜ¼Æ »P ÅÜ¼Æ ¤S¸Ó¦p¦ó¦ê±µ

½Ð¤j¤j«ü¾É¤@¤U
  1. Private Sub CommandButton1_Click()

  2. Dim Fs, t, Wb As Workbook, St As Worksheet
  3. Dim k%, X%, i%

  4. 'On Error Resume Next
  5.     Fs = Application.GetOpenFilename("Excel,*.xls", , , , True)
  6.         If Not IsArray(Fs) Then Exit Sub
  7.             For Each t In Fs
  8.                 If t <> ThisWorkbook.Name Then
  9.                     Set Wb = GetObject(t)
  10.                         For Each St In Wb.Worksheets
  11. With St
  12.     k = .Range("B65536").End(xlUp).Row
  13. End With

  14.     With St.Range("A9:O9")
  15.         For i = .Cells.Count To 1 Step -1
  16.             If .Cells(i).Borders.LineStyle = xlContinuous Then
  17.                 X = i
  18.                 Exit For
  19.             End If
  20.         Next
  21.     End With
  22.    
  23.    
  24.                         
  25. With St.PageSetup
  26.     If k <= 45 Then
  27.     .PrintArea = Range("A1:X & 45").Address        '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  28.    
  29.     ElseIf k <= 82 Then
  30.     .PrintArea = "A1:x" & 82                       '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  31.    
  32.     ElseIf k <= 115 Then
  33.     .PrintArea = "A1:x" & 115                      '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  34.    
  35.     ElseIf k <= 151 Then
  36.     .PrintArea = "A1:x" & 151                      '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  37.    
  38.     Else
  39.     .PrintArea = "A1:" & X & k & ""                '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  40.    
  41.     End If
  42. End With



  43. With St.Range("A12:X" & 151).Borders               '³o¦æªº»yªk ¦ê¤£¥X¨Ó
  44.     .LineStyle = xlContinuous
  45.     .Weight = xlHairline
  46.     .ColorIndex = 1
  47. End With
  48.                     St.PrintOut
  49.                 Next
  50.             Wb.Close 0
  51.         End If
  52.      Next
  53. End Sub
½Æ»s¥N½X

.PrintArea = Range("A1:X45").Address
    .PrintArea = "A1:x82"
    .PrintArea = "A1:x115"
    .PrintArea = "A1:x151"
    .PrintArea = "A1:X" & trim(str(k))
With St.Range("A12:X151").Borders
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 2# kimbal


ÁÂÁª©¤jªº«üÂI     ¤£¹L¦b¸g¹L´ú¸Õ¤§«á
With PageSetup
If K <= 45 Then
  .PrintArea = "A1:x45"
¤W¦¡¤¤ªºx ¨Ã«D§Ú­nªº«¬ºA(ÅܼÆx)
»P x = i  ªºx µLªk³sµ²

¥i§_½Ð¤j¤j¦bÀ°§Ú¬Ý¤@¤U^-^:D

ÁÙ¦³¤@­Ó¤p°ÝÃD´N¬O Trim(Str(K)) ³o¦ê¬O¤°»ò·N«ä???:Q
  1. Private Sub CommandButton1_Click()

  2. Dim Fs, t, Wb As Workbook, St As Worksheet
  3. Dim K%, x%, i%


  4.     Fs = Application.GetOpenFilename("Excel,*.xls", , , , True)   '
  5.         If Not IsArray(Fs) Then Exit Sub
  6.             For Each t In Fs
  7.                 If t <> ThisWorkbook.Name Then
  8.                     Set Wb = GetObject(t)
  9.                         For Each St In Wb.Worksheets
  10.                     
  11.                     With St.Cells
  12.                         K = .Range("B65536").End(xlUp).Row
  13.                     End With
  14.                     
  15.                         With St.Range("A9:O9")
  16.                                 For i = .Cells.Count To 1 Step -1
  17.                                     If .Cells(i).Borders.LineStyle = xlContinuous Then
  18.                                             x = i
  19.                                             Exit For
  20.                                     End If
  21.                                 Next
  22.                         End With
  23.                                        
  24.                     With St.PageSetup
  25.                     
  26.                     If K <= 45 Then
  27.                     .PrintArea = "A1:x45"
  28.                     '.PrintArea = Range("A1:X45").Address
  29.                
  30.                     ElseIf K <= 82 Then
  31.                     .PrintArea = "A1:x82"
  32.                     '.PrintArea = "A1:x82"
  33.                     
  34.                     ElseIf K <= 115 Then
  35.                     .PrintArea = "A1:x115"
  36.                     '.PrintArea = "A1:x115"
  37.                     
  38.                     ElseIf K <= 151 Then
  39.                     .PrintArea = "A1:x151"
  40.                     '.PrintArea = "A1:x151"
  41.                     
  42.                     Else
  43.                         .PrintArea = "A1:x" & Trim(Str(K))          '¦C¦L½d³ò"
  44.                        '.PrintArea = "A1:X" & Trim(Str(K))
  45.                        '.Zoom = 100                                            'ÁY©ñ¤ñ¨Ò
  46.                         End If
  47.                     End With

  48.                     
  49.                     With St.Range("A12:x151").Borders
  50.                     'With St.Range("A12:X151").Borders
  51.                              .LineStyle = xlContinuous                   '½uºØÃþ =¹ê½u
  52.                              .Weight = xlHairline                            '½u²Ê²Ó=·¥²Ó
  53.                              .ColorIndex = 1                                  ' ½u¦â , 1=¶Â¦â
  54.                      End With


  55.                             St.PrintOut
  56.                         
  57.                     Next
  58.                 Wb.Close 0
  59.                 End If
  60.             Next
  61. End Sub
½Æ»s¥N½X

TOP

¦U¦ì«e½ú¯àÀ°¸Ñµª¤@¤U¶Ü~~~~

TOP

  1. Sub yy()
  2. x = 100
  3. MsgBox Range(Cells(1, 1), Cells(45, x)).Address
  4. End Sub
½Æ»s¥N½X
¹B¦æ¤@¤UÀ³¸Ó´N©ú¥Õ¤F¡C

TOP

¦^´_ 5# oobird


    ÁÂÁÂoobird¦Ñ®vªº«ü¾É

¥t¥~§Ú§â¥L®M¶i With St.Range(Cells(1, 1), Cells(45, x)).Borders
                         .LineStyle = xlContinuous                  
                         .Weight = xlHairline                        
                         .ColorIndex = 1                              
                  End With
¬°¦ó°õ¦æ°_¨Ó¦³¿ù»~  ¬O­þ¸Ì¼gªº¤£¹ï¹À??

TOP

­Y§A°õ¦æ®É·í«e¤u§@ªí¤£¬OStªº¸Ü¡A­n³o¼Ë¼g¤~¯à³QÃѧO¡G
With St.Range( St.Cells(1, 1),  St.Cells(45, x)).Borders

TOP

RE: ¦r¤¸»PÅÜ¼Æ ­n¦p¦ó¦ê±µ(¤w¸Ñ¨M)

¦^´_ 7# oobird


    ¦A¦¸ÁÂÁÂoobird¦Ñ®vªº«ü¾É

§Ú·í«e°õ¦æªº¤u§@ªí¬Ost, ¥u¬O¤@­È¶]¤£¹L

«á¨Ó¶K¤Woobird«e½ú©Ò«üÂIªº»yªk«á ¸Ó¬q³]©w´N¯à¥¿±`°õ¦æ¤F

ÁöµM¤@ª½·d¤£¤Ó¸³ ¤£¹LÁÙ¬O­nÁÂÁ¦U¦ì¥ý¶iªº«üÂI^-^:lol

TOP

¦^´_ 8# alex520188
§Ú·í«e°õ¦æªº¤u§@ªí¬Ost, ¥u¬O¤@­È¶]¤£¹L
  
¦pªG§Aªºµ{¦¡¬O¦b ¤u§@ªí¼Ò²Õ ¥B¤£¬Ost¤u§@ªí¼Ò²Õ ´N·|¦p¦¹  
¤u§@ªí¼Ò²Õ ¤u§@ªí¤¤ªºª«¥ó ¦p¨S«ü©ú¤÷¼h¦WºÙ ,¹w³]¬° ¦¹¤u§@ªí¼Ò²Õªº¤u§@ªí.
·í«e°õ¦æªº¤u§@ªí¬Ost §Aªºµ{¦¡¬O¦b ¬Ost¤u§@ªí¼Ò²Õ ¤£·|¦p¦¹ªº
·í«e°õ¦æªº¤u§@ªí¬Ost §Aªºµ{¦¡¬O¦b ¬O¤@¯ë¼Ò²Õ ©Î¬OThisWorkbook¼Ò²Õ  ¤]¤£·|¦p¦¹ªº

TOP

        ÀR«ä¦Û¦b : ¦n¨Æ­n´£±o°_¡A¬O«D­n©ñ±o¤U¡A¦¨´N§O¤H§Y¬O¦¨´N¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD