combining two short VBA scripts from two buttons
Hey Sloan, To answer question about Form Control verus Control ToolBox
Controls is. The Forms Controls a hold over from Excel 5 and Excel 95. which
gives you basic Controls. The Contol ToolBox Control are ActiveX controls.
The ActiveX controls have events and properties that set and use for more
flexible use of the required control. ie I reset the Caption property each
time I clicked on the CommandButton. The forms control does not have this
capability.
There serval good books on begining VBA for Excel. John Walkenbach has
severl books, I use," Excel 2000 Power Programing with VBA", I also use
John Green's , "Excel 2000 VBA Programmer's Reference".
HTH again, Rick
PS: Yes, the if/then is acting as on/off with the use of the Static
Boolean variable 'flag'. When the excel program initially starts the flag
variable is set to false. When the CommandButton is clicked the Caption of
of button changes, also the value of flag will change to true. Click the
Button again and the Caption changes back, the flag value is set back to
false. I should also note the selected columns hide and unhide, with each
toggle of the CommandButton. That in a nut shell is how the code works.
wrote in message
oups.com...
That's great!! I grabbed this code and switched over to the control
toolbox button. It's right-on, and I can (mostly) understand what's
going on. If/Then = on/off.
Bob, thanks for your idea, too. I couldn't get it to work, though. VBA
editor said there was a syntax error in the line:
.EntireColumn.Hidden = not .EntireColumn.Hidden =
A follow up question:
What's the difference between using the button from the
Tools--Customize--Commands:Forms area versus the button from the
Control Toolbox?
And can anyone reccommend a good starter text for basic VBA I'd use in
Excel?
|