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
.
|