PDA

View Full Version : Click Event



jbbman
06-28-2010, 02:06 PM
In VBA, how do you put a click event on a spreadsheet where you click the command button once and the spreadsheet minimizes and you click the button again and it maximizes?:banghead: Thanks.

jbbman

Bob Phillips
06-28-2010, 02:30 PM
If the spreadsheet minimizes, how are you going to then click the button?

Aussiebear
06-28-2010, 02:34 PM
Where do you intend to hide the button? If the button resides on the sheet that you minimise, it dissappears with the sheet.

jbbman
06-29-2010, 05:17 AM
You made a good point. It's really the concept of using one command button to do two things. You could switch between normalizing and maximizing the spreadsheet/window. It doesn't even have to be a window or spreadsheet, it could be bolding or unbolding a cell.

I thought I saw , I could be mistaken, a command button that used If...Then statement with the vba not operator to do turn something on and off like a boolean switch. The first click enabled the command and the second disabled the command, like a light switch. Thanks.:bug:

P.S. Couldn't the command button be placed on a form, At least with the spreadsheet?

Bob Phillips
06-29-2010, 05:33 AM
You mean something like



With Activecell.Font

.Bold = Not .Bold
End With

mdmackillop
06-29-2010, 05:33 AM
With Application
If .WindowState = xlNormal Then
.WindowState = xlMaximized
Else
.WindowState = xlNormal
End If
End With

Using Not is something like this, where there can only be two states


ActiveCell.Font.Bold = Not ActiveCell.Font.Bold

jbbman
06-29-2010, 05:47 AM
Thank you thank you. That's it. Sorry for the trouble.
-jbbman