View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roger Whitehead[_4_] Roger Whitehead[_4_] is offline
external usenet poster
 
Posts: 29
Default 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