Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to disable/enable command button(ActiveX) using macro enahs_naneek Excel Discussion (Misc queries) 1 February 5th 10 12:32 PM
HOW TO DO ENABLE ENABLE THE QUERY PARAMETER BUTTON? CPW Excel Worksheet Functions 1 January 21st 10 06:31 PM
enable/disable button based on cell value Shoney Excel Discussion (Misc queries) 3 January 9th 08 07:34 PM
Enable/Disable Button surplusbc[_6_] Excel Programming 1 February 1st 04 09:53 PM
Enable/Disable Macros Joseph[_6_] Excel Programming 3 August 23rd 03 02:54 PM


All times are GMT +1. The time now is 07:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"