excel中点击按钮,,按钮颜色变为红色;同时A1为1值,再次点击,按钮恢复原样,同时A1为空,这个可以做吗?
2个回答
2014-10-05
展开全部
Private Sub CommandButton2_Click()
If CommandButton2.BackColor = &HC0C0FF Then
[A1] = ""
CommandButton2.BackColor = &H8000000F
Else
[A1] = 1
CommandButton2.BackColor = &HC0C0FF
End If
End Sub
If CommandButton2.BackColor = &HC0C0FF Then
[A1] = ""
CommandButton2.BackColor = &H8000000F
Else
[A1] = 1
CommandButton2.BackColor = &HC0C0FF
End If
End Sub
展开全部
这个可以,vba简单
更多追问追答
追问
给我写一下嘛,我不会写,谢谢了
追答
把控件工具箱搞出来,插入个按钮,按钮上双击
Private Sub CommandButton1_Click()
If [a1] = "" Then
[a1] = 1
Me.CommandButton1.BackColor = &HFF&
Else
[a1] = ""
Me.CommandButton1.BackColor = &H8000000F
End If
End Sub
然后把设计模式关掉,就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询