Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 270
Default Macros and buttons

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 857
Default Macros and buttons

Sandy,

Here's an example with 2 buttons (Button 1 and Button 2). Clicking one
button hides itself and shows the other.


Sub Button1_Click()
ActiveSheet.Shapes("Button 1").Visible = False
ActiveSheet.Shapes("Button 2").Visible = True
End Sub

Sub Button2_Click()
ActiveSheet.Shapes("Button 1").Visible = True
ActiveSheet.Shapes("Button 2").Visible = False
End Sub


--
Hope that helps.

Vergel Adriano


"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 270
Default Macros and buttons

Hi

I get the gist of it but how do I find the "name" of the buttons, - stupid
question but I am dumb at controls etc

Sandy

"Vergel Adriano" wrote in message
...
Sandy,

Here's an example with 2 buttons (Button 1 and Button 2). Clicking one
button hides itself and shows the other.


Sub Button1_Click()
ActiveSheet.Shapes("Button 1").Visible = False
ActiveSheet.Shapes("Button 2").Visible = True
End Sub

Sub Button2_Click()
ActiveSheet.Shapes("Button 1").Visible = True
ActiveSheet.Shapes("Button 2").Visible = False
End Sub


--
Hope that helps.

Vergel Adriano


"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C
invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Macros and buttons

One way:

Attach macro A to button C. In Macro A, include the lines:

Worksheets("Sheet1").Buttons("Button C").Visible = False
Worksheets("Sheet1").Buttons("Button D").Visible = True

(adjust the names to suit). Put the opposite configuration in Macro B.

In article ,
"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 270
Default Macros and buttons

Hi

I get the gist of it but how do I find the "name" of the buttons, - stupid
question but I am dumb at controls etc

Sandy

"JE McGimpsey" wrote in message
...
One way:

Attach macro A to button C. In Macro A, include the lines:

Worksheets("Sheet1").Buttons("Button C").Visible = False
Worksheets("Sheet1").Buttons("Button D").Visible = True

(adjust the names to suit). Put the opposite configuration in Macro B.

In article ,
"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C
invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Macros and buttons

Select the button (right-click it), and look in the Name box on the left
side of the formula toolbar.

In article ,
"Sandy" wrote:

Hi

I get the gist of it but how do I find the "name" of the buttons, - stupid
question but I am dumb at controls etc

Sandy

"JE McGimpsey" wrote in message
...
One way:

Attach macro A to button C. In Macro A, include the lines:

Worksheets("Sheet1").Buttons("Button C").Visible = False
Worksheets("Sheet1").Buttons("Button D").Visible = True

(adjust the names to suit). Put the opposite configuration in Macro B.

In article ,
"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can I
have button C run Macro A and then at the end of the code make C
invisisble
and D visible. Then have button D run Macro B and at the end of the code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 270
Default Macros and buttons

Thank you - working perfectly now
Sandy

"JE McGimpsey" wrote in message
...
Select the button (right-click it), and look in the Name box on the left
side of the formula toolbar.

In article ,
"Sandy" wrote:

Hi

I get the gist of it but how do I find the "name" of the buttons, -
stupid
question but I am dumb at controls etc

Sandy

"JE McGimpsey" wrote in message
...
One way:

Attach macro A to button C. In Macro A, include the lines:

Worksheets("Sheet1").Buttons("Button C").Visible = False
Worksheets("Sheet1").Buttons("Button D").Visible = True

(adjust the names to suit). Put the opposite configuration in Macro B.

In article ,
"Sandy" wrote:

Hi

I have 2 macros A and B say and two buttons Cand D on a worksheet. Can
I
have button C run Macro A and then at the end of the code make C
invisisble
and D visible. Then have button D run Macro B and at the end of the
code
make C visible and D invisible - am I making myself clear?
The buttons were placed on the sheet from the form toolbar.

Sandy



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
Buttons and macros Richardisa1 New Users to Excel 3 March 23rd 07 09:25 PM
Macros AND Buttons [email protected] Excel Worksheet Functions 3 August 9th 06 09:03 AM
Macros And Buttons [email protected] Excel Discussion (Misc queries) 4 August 8th 06 10:37 PM
Buttons and macros? Joe Excel Discussion (Misc queries) 3 October 7th 05 02:34 AM
buttons & macros Jock W Excel Worksheet Functions 4 April 30th 05 07:35 AM


All times are GMT +1. The time now is 10:10 PM.

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

About Us

"It's about Microsoft Excel"