2016-07-22 75 views
0

我正在尋找一個excel的宏,它將設置所有單元格填充爲不填充,並使所有單元格都沒有邊框。我的工作簿中有多個電子表格,並希望將其應用於所有這些電子表格。我已經通過互聯網尋找所有這樣做的東西,但沒有達到。沒有填充和無國界的宏

回答

1

這應該這樣做。只需將它添加到任何分支,你就可以走了:

Dim wsCount As Integer 
Dim i As Integer 

wsCount = ActiveWorkbook.Worksheets.Count 

For i = 1 to wsCount 
    Worksheets(i).Activate 
    Cells.Select 
    With Selection.Interior 
     .Pattern = xlNone 
     .TintAndShade = 0 
     .PatternTintAndShade = 0 
    End With 
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone 
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone 
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone 
    Selection.Borders(xlEdgeTop).LineStyle = xlNone 
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone 
    Selection.Borders(xlEdgeRight).LineStyle = xlNone 
    Selection.Borders(xlInsideVertical).LineStyle = xlNone 
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone 
Next i 
+0

工作正常!我感謝您的幫助! – dontchucknorris