excel vba 请高手帮忙看看我这代码哪里出错了?

2024-11-22 07:10:04
推荐回答(2个)
回答1:

Cells(a, b - 1) 这个条件有可能让 列为0 出错

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
a = Selection.Row
b = Selection.Column
If b >= 2 And b <= 7 And Cells(a, b) = ""Then
if Cells(a, b - 1) <> "" then

AppActivate "Mozilla Firefox"
end if
End If
End Sub

回答2:

你的if前加一句:

if b=1 then exit sub