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

Ãö©ó¸óÄæ¸m¤¤©M®Ø½uµe½u¬O§_¦³¤ñ¸û²©öªº¼gªk(ÁÂÁ¦U¦ì¤j¤j¡A¤w¸Ñ¨M¡C)

Ãö©ó¸óÄæ¸m¤¤©M®Ø½uµe½u¬O§_¦³¤ñ¸û²©öªº¼gªk(ÁÂÁ¦U¦ì¤j¤j¡A¤w¸Ñ¨M¡C)

¥»©«³Ì«á¥Ñ av8d ©ó 2012-4-27 08:12 ½s¿è

­º¥ýA1:H1©MA2:H2Äæ¨ú®ø¸óÄæ¸m¤¤
  1.     Range("A1:G1").Select
  2.     With Selection
  3.         .HorizontalAlignment = xlCenter
  4.         .VerticalAlignment = xlCenter
  5.         .WrapText = False
  6.         .Orientation = 0
  7.         .AddIndent = False
  8.         .IndentLevel = 0
  9.         .ShrinkToFit = False
  10.         .ReadingOrder = xlContext
  11.         .MergeCells = False
  12.     End With
  13.     Selection.Merge
  14.     Range("A2:G2").Select
  15.     With Selection
  16.         .HorizontalAlignment = xlCenter
  17.         .VerticalAlignment = xlCenter
  18.         .WrapText = False
  19.         .Orientation = 0
  20.         .AddIndent = False
  21.         .IndentLevel = 0
  22.         .ShrinkToFit = False
  23.         .ReadingOrder = xlContext
  24.         .MergeCells = False
  25.     End With
  26.     Selection.Merge
  27. End Sub
½Æ»s¥N½X
µM«á¬OA1:G1©MA2:G2¸óÄæ¸m¤¤
  1.     Range("A1:H1").Select
  2.     With Selection
  3.         .HorizontalAlignment = xlGeneral
  4.         .VerticalAlignment = xlCenter
  5.         .WrapText = False
  6.         .Orientation = 0
  7.         .AddIndent = False
  8.         .IndentLevel = 0
  9.         .ShrinkToFit = False
  10.         .ReadingOrder = xlContext
  11.         .MergeCells = True
  12.     End With
  13.     Selection.UnMerge
  14.     Range("A2:H2").Select
  15.     With Selection
  16.         .HorizontalAlignment = xlGeneral
  17.         .VerticalAlignment = xlCenter
  18.         .WrapText = False
  19.         .Orientation = 0
  20.         .AddIndent = False
  21.         .IndentLevel = 0
  22.         .ShrinkToFit = False
  23.         .ReadingOrder = xlContext
  24.         .MergeCells = True
  25.     End With
  26.     Selection.UnMerge
½Æ»s¥N½X
µM«áA1:G2®Ø½uµe¥k½u
  1.     Range("A1:G2").Select
  2.     Selection.Borders(xlDiagonalDown).LineStyle = xlNone
  3.     Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  4.     With Selection.Borders(xlEdgeLeft)
  5.         .LineStyle = xlContinuous
  6.         .ColorIndex = 0
  7.         .TintAndShade = 0
  8.         .Weight = xlThin
  9.     End With
  10.     With Selection.Borders(xlEdgeTop)
  11.         .LineStyle = xlContinuous
  12.         .ColorIndex = 0
  13.         .TintAndShade = 0
  14.         .Weight = xlThin
  15.     End With
  16.     With Selection.Borders(xlEdgeBottom)
  17.         .LineStyle = xlContinuous
  18.         .ColorIndex = 0
  19.         .TintAndShade = 0
  20.         .Weight = xlThin
  21.     End With
  22.     With Selection.Borders(xlEdgeRight)
  23.         .LineStyle = xlContinuous
  24.         .ColorIndex = 0
  25.         .TintAndShade = 0
  26.         .Weight = xlThin
  27.     End With
  28.     Selection.Borders(xlInsideVertical).LineStyle = xlNone
  29.     With Selection.Borders(xlInsideHorizontal)
  30.         .LineStyle = xlContinuous
  31.         .ColorIndex = 0
  32.         .TintAndShade = 0
  33.         .Weight = xlThin
  34.     End With
  35. End Sub
½Æ»s¥N½X

¹ï©ó¿ý»sªº¥N½X¡A§AÀ³¸Ó§â·Æ¹«©ñ¦b¨C¤@¦æ¤W«öF1¡A¬d¬Ý¥¦¬O°µ¤°»ò¥Îªº
µM«á§A´Nª¾¹D­þ¨Ç»y¥y¬O¥Î¤£¨ìªº¤F¡C
®³¨Ó¥Îªº¥N½X¹ï¾Ç²ßµL¦h¤jÀ°§U¡C

TOP

¦^´_ 1# av8d
  1. Sub aa()
  2. [A1:G1].Merge
  3. [A1:G1].HorizontalAlignment = xlCenter
  4. [A2:G2].Merge
  5. [A2:G2].HorizontalAlignment = xlCenter
  6. End Sub
  7. Sub bb()
  8. [A1:G1].UnMerge
  9. [A2:G2].UnMerge
  10. End Sub
  11. Sub cc()
  12. [A1:G2].Borders.LineStyle = xlContinuous
  13. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# av8d
  1. Sub Ex()
  2.     Dim xi As Integer
  3.     For xi = 2 To 10 Step 2
  4.         With Range("A1:C1,E1:G1").Offset(xi)
  5.             .Merge
  6.             .HorizontalAlignment = xlCenter
  7.             .Borders.LineStyle = xlContinuous
  8.         End With
  9.     Next
  10. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-4-24 19:09 ½s¿è

¦b¤@±i¤u§@ªí¸Ì
¥i¯à¦³¦n´X­Ó¦a¤è­nµe²Ê¥~®Ø½u©M¸óÄæ¸m¤¤

§Ú²{¦b³£±Nµe®Ø½u©M¸óÄæ¸m¤¤¼g¦¨ ¨ç¦¡
¤Þ¼Æ¬O Range ª«¥ó
¨C¦¸­nµe®Ø½u©Î¸óÄæ¸m¤¤®É
´N¥h©I¥s¨ç¦¡   ex.    Call µe²Ê¥~®Ø(Range("A1:A10"))
¬Ù±o­«½Æ¤@°ï Code
Alex

TOP

¦^´_ 5# alexliou
¥i¥H¶K¤Wµ{¦¡½X ¤À¨É¶Ü?

TOP

¦^´_ 6# GBKEE
³o¥u¬O§âµe²Ê¥~®Øªºcode¶°¦X¦b¤@°_¦Ó¤w

Sub µe²Ê¥~®Ø(oRrange As Range)
    oRange.Borders(xlDiagonalDown).LineStyle = xlNone
    oRange.Borders(xlDiagonalUp).LineStyle = xlNone
    With oRange.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .Weight = xlMedium
    End With
    With oRange.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .Weight = xlMedium
    End With
    With  oRange.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .Weight = xlMedium
    End With
    With  oRange.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .Weight = xlMedium
    End With
     oRange.Borders(xlInsideVertical).LineStyle = xlNone
     oRange.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub

¦p­n§ó¼u©Ê¤@ÂI, ¥i±N®Ø½uªº²Ê²Ó,ÃC¦â³£³]¦¨¤Þ¼Æ
Alex

TOP

¦^´_ 7# alexliou
²¤Æ¤@¤U
  1. Option Explicit
  2. Sub µe²Ê¥~®Ø(oRange As Range)
  3.     Dim xi As Integer
  4.     With oRange
  5.         .Borders(5).LineStyle = xlNone      '¥k±×½u
  6.         .Borders(6).LineStyle = xlNone      '¥ª±×½u
  7.         For xi = 7 To 10                    '¥~®Ø: ¥ª>¤W>¤U>¥k
  8.             With .Borders(xi)
  9.                 .LineStyle = xlContinuous
  10.                 .ColorIndex = 3
  11.                 .Weight = xlMedium
  12.             End With
  13.         Next
  14.         If .Columns.Count > 1 Then          'ª½½u  »Ý¨âÄæ¥H¤W
  15.             With .Borders(11)
  16.                 .LineStyle = 1  '
  17.                 .ColorIndex = 3
  18.             End With
  19.         End If
  20.         If .Rows.Count > 1 Then             '¾î½u   »Ý¨â¦C¥H¤W
  21.             With .Borders(12)
  22.                 .LineStyle = 1
  23.                 .ColorIndex = 3
  24.             End With
  25.         End If
  26.      End With
  27. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ oobird ©ó 2012-4-25 08:02 ½s¿è
  1. Sub yy()
  2.     With Selection
  3.         .Borders.LineStyle = 0
  4.         .Borders.LineStyle = 1
  5.         .Borders.ColorIndex = 5
  6.         .BorderAround , 3, 5
  7.     End With
  8. End Sub
½Æ»s¥N½X
¥i¿ï¨ú¤@­Ó½d³ò¡A©Î¦P®É¿ï¦h­Ó°Ï°ì¡A¤@°_µ¹®Ø½u¡C¤º®Ø¬°1¡A¥~®Ø¬°3¡A5¬OÃC¦â

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD