Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable/disable a button.
Hi!
I have a problem in writing macro add in. I have created a button specially for pivot table. When the selected cell is in pivot table, this button will be enabled and vice versa. I donno how to write this kind of macro. Can somebody give me some hints to do? Thanks! Polly |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable/disable a button.
Hi Polly,
Dim rng As Range On Error Resume Next Set rng = ActiveCell.PivotTable.TableRange2 If rng Is Nothing Then commandbutton1.Enabled = False Else commandbutton1.Enabled = True End If On Error GoTo 0 -- HTH Roger Shaftesbury (UK) "Polly" wrote in message ... Hi! I have a problem in writing macro add in. I have created a button specially for pivot table. When the selected cell is in pivot table, this button will be enabled and vice versa. I donno how to write this kind of macro. Can somebody give me some hints to do? Thanks! Polly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable/disable a button.
Thanks! Roger.
I would like to know where the code should be put. I have tried many places. Only when I put them in a worksheet, it works. However, some people may not use my worksheet. They may open or insert a new one. Polly -----Original Message----- Hi Polly, Dim rng As Range On Error Resume Next Set rng = ActiveCell.PivotTable.TableRange2 If rng Is Nothing Then commandbutton1.Enabled = False Else commandbutton1.Enabled = True End If On Error GoTo 0 -- HTH Roger Shaftesbury (UK) "Polly" wrote in message ... Hi! I have a problem in writing macro add in. I have created a button specially for pivot table. When the selected cell is in pivot table, this button will be enabled and vice versa. I donno how to write this kind of macro. Can somebody give me some hints to do? Thanks! Polly . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to disable/enable command button(ActiveX) using macro | Excel Discussion (Misc queries) | |||
HOW TO DO ENABLE ENABLE THE QUERY PARAMETER BUTTON? | Excel Worksheet Functions | |||
enable/disable button based on cell value | Excel Discussion (Misc queries) | |||
Enable/Disable Button | Excel Programming | |||
Enable/Disable Macros | Excel Programming |