我有什么:
BeforeDoubleClick
事件,如果双击entirerow.font.color
中的单元格,则将column A
从黑色更改为红色。 这表明我添加了一个新项目。
-
我要做的是:
我如何才能在columns E:X
之间的单个单元格上进行双击事件? 如果我们更改现有商品的数量,则会显示。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
If Not Application.Intersect(ActiveCell, Range("A9:A" & finalrow)) Is Nothing Then
If Target.Font.Color = vbRed Then
Target.EntireRow.Font.Color = vbBlack
Else
Target.EntireRow.Font.Color = vbRed
End If
End If
Cancel = True
End Sub
编辑:使用以下内容...
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
If Not Application.Intersect(ActiveCell, Range("A9:A" & finalrow)) Is Nothing Then
If Target.Font.Color = vbRed Then
Target.EntireRow.Font.Color = vbBlack
Else
Target.EntireRow.Font.Color = vbRed
End If
End If
If Not Intersect(Target, Range("E9:X500")) Is Nothing Then
If Target.Font.Color = vbRed Then
Target.Font.Color = vbBlack
Else
Target.Font.Color = vbRed
End If
End If
Cancel = True
End Sub