を削除し、これはスクリプトです:は、私は理解できない問題を抱えているセル
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
Dim ws As String
Dim sht As Worksheet
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
ws = ActiveSheet.Name
' Begin the loop.
For I = 1 To WS_Count
For Each sht In ActiveWorkbook.Worksheets
ws = Worksheets(I).Name
Dim x As Range
Set x = Worksheets(I).UsedRange
x.ClearComments
x.Replace What:="*€£$*", Replacement:=""
For Each Cell In Worksheets(I).UsedRange
If x.Font.Color <> Black Then
x.Delete
End If
Next
Next sht
Next I
End Sub
コードのすべてを除いて動作します:
For Each Cell In Worksheets(I).UsedRange
If x.Font.Color <> Black Then
x.Delete
End If
Next
これを黒色に変更しようとしましたが、これはまだ動作しません。私はその時点でステップアップを試みました。セルを削除する資格を持つセルは決して見つけられません。
私はフォントが、実際に黒ではないと思いたいです。セルの1つを選択し、 'Activecell.font.color'をテストしようとしましたか? – Rory
私が達成しようとしている主なことは、フォントの色が黒でないすべてのセルを削除することです。確かに黒ではないセルがありますが、私はアクティブセルのアイデアを試してみましょう。ありがとうございました –
すべてのセルは複数の色を含む可能性があります。任意のセルの最初の文字は黒で、2番目の文字は赤で、3番目の文字は緑になる可能性があります。したがって、任意のセルの最初の文字を次のようにチェックすることができます: 'x.Characters(1,1).Font.Color <> vbBlackおよびx.Characters(1,1).Font.Color <> 5920858それから。 – Ralph