1Sub Sample()
2 Dim ws As Worksheet, c As Range
3 Set ws = ActiveSheet
4 For Each c In Intersect(ws.UsedRange, ws.Columns("AJ"))
5 c.Value = IIf(c.Font.ColorIndex = 3, -1, 1) * Abs(c.Value)
6 Next
7End Sub
8
1Sub AddMinusIfRed()
2 Const 特定の色 = vbRed 'vbRedは例
3 Dim cell As Range
45 For Each cell In Selection
6 If cell.Font.Color = 特定の色 Then
7 cell = "-" & cell
8 End If
9 Next
10End Sub