2010-04-05 8 views
1

를 포맷/속성을 제공하는 행의 모든 ​​셀을 통해 루프에 대한이 같은 엑셀 SS 뭔가의 첫 번째 행을하고 싶은 말은 전체 선택이 아닌 개요가 있어야합니다. 행 1의 각 셀에 대해 위의 아이디어를 어떻게 수행 할 수 있습니까?Excel 2003의 VBA는

고마워요!

답변

1

을했다 :

Dim c As Range 
For Each c In ActiveSheet.Range("1:1") 
    c.Select 
    With Selection.Borders(xlEdgeLeft) 
     .LineStyle = xlContinuous 
     .Weight = xlMedium 
     .ColorIndex = xlAutomatic 
    End With 
Next 

그러나 이것은 시간이 오래 걸릴 수 있으므로에 Application.ScreenUpdating 설정 시작하기 전에 거짓!

+0

대단히 감사합니다! – Justin

2

는 또한 xlInsideHorizontal

기록에게 매크로를 설정하고 결과는 그 쉬운

Selection.Borders(xlDiagonalDown).LineStyle = xlNone 
Selection.Borders(xlDiagonalUp).LineStyle = xlNone 
With Selection.Borders(xlEdgeLeft) 
    .LineStyle = xlContinuous 
    .ColorIndex = xlAutomatic 
    .TintAndShade = 0 
    .Weight = xlThin 
End With 
With Selection.Borders(xlEdgeTop) 
    .LineStyle = xlContinuous 
    .ColorIndex = xlAutomatic 
    .TintAndShade = 0 
    .Weight = xlThin 
End With 
With Selection.Borders(xlEdgeBottom) 
    .LineStyle = xlContinuous 
    .ColorIndex = xlAutomatic 
    .TintAndShade = 0 
    .Weight = xlThin 
End With 
With Selection.Borders(xlEdgeRight) 
    .LineStyle = xlContinuous 
    .ColorIndex = xlAutomatic 
    .TintAndShade = 0 
    .Weight = xlThin 
End With 
Selection.Borders(xlInsideVertical).LineStyle = xlNone 

'I think this is what you were missing 
With Selection.Borders(xlInsideHorizontal) 
    .LineStyle = xlContinuous 
    .ColorIndex = xlAutomatic 
    .TintAndShade = 0 
    .Weight = xlThin 
End With 
+0

xlInsideVertical이되어야합니다. (나는 생각한다) – guitarthrower

+0

나는 Record Macro를 사용하여이를 테스트했다. 그래서 생성 된 코드는 X-이다. –

관련 문제