-1
大家好我有,當我複製分組表顏色變化的電子表格40級的標籤,VBA紙色範圍格式
我寫了一個代碼只更新受影響的表,但它不工作,任何幫助將是讚賞。
Sub Color()
Application.ScreenUpdating = False
Application.Calculation = xlAutomatic
Application.DisplayAlerts = False
Dim ws As Worksheet
Dim ws1 As Worksheet
Dim r1 As Range
Dim r2 As Range
Dim rngs As Range
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "A" And ws.Name <> "B" And ws.Name <> "C" And _
ws.Name <> "D" And ws.Name <> "E" And ws.Name <> "F" Then
Set r1 = Range("B1:E3")
Set r2 = Range("N1:P3")
Set rngs = Union(r1, r2)
With rngs.Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
Application.DisplayAlerts = True
End Sub
使用'選擇案例ws.Name'然後'案 「A」,」 B「,」C「,」D「,」E「,」F「,並在」Case Else「下寫這個邏輯。 –