excel的VBA编译语法错误怎么改?

2024-12-15 16:56:17
推荐回答(2个)
回答1:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count=1 Then
if target.row>=6 and target.row<=12 then
if target.column>=6 and target.column<=9 then
target="Test"
end if
end if
End If
End Sub

回答2:

Private Sub Worksheet_Change(ByVal Target As Range)

Set Rng = Application.Intersect(Target, Range("$F$6:$I$12"))
If Not Rng Is Nothing Then
Application.EnableEvents = False
Rng.Value = "Test"
Application.EnableEvents = True
End If
End Sub