Hi toecutter,
couldnt you just delete it?
StefanVB:ActiveSheet.Shapes("CommandButton2").Delete
hi
is it possible to add code to a sheet command buton to hide it after it has been selected?
i found a similar example in the forum but it didnt work.
i have this code in a module to open the form but it dosnt hide the sheet command button?
cheersVB:Sub Button2_Click() ufmRoofing.Show Button2.Visible = False End Sub
toe
(cheif idiot)
Last edited by toecutter; January 19th, 2006 at 13:08.
Hi toecutter,
couldnt you just delete it?
StefanVB:ActiveSheet.Shapes("CommandButton2").Delete
no m8
the user will do this with maybe 6 command buttons then start again .
so i will also need a command button to unhide all the hidden ones.
Hi ToeCutter:
Try this if your command button is from CONTROL TOOLBOX
RegardsVB:Me.CommandButton1.Visible = False 'OR Sheets(" iNFORMATION").Shapes("cOMMANDBUTTON1").Visible = False UserForm1.Show
Maqbool
thx MaqboolOriginally Posted by Maqbool
i tried your code in different variations with no luck.
the command button is on a xls. sheet form the forms tools.
maybe i should be using the CONTROL TOOLBOX?
toe
Hi ToeCutter:
If you are using Forms Toolbar try this.
RegardsVB:Sub Button5_Click() Dim ws As Worksheet Set ws = Sheet1 With ws .Shapes("Button 4").Visible = msoFalse End With End Sub
Maqbool
Originally Posted by Maqbool
Maqbool
correct me if iam wrong.
on a xls sheet there is 2 options for forms?
1: CONTROL TOOLBOX
2: FORMS
these 2 options do not include the VBA forms?
toe
Last edited by toecutter; January 19th, 2006 at 15:49.
Hi Toecutter:
I don't understand your question. Anyway, I hope you need more information about Control ToolBox & Form Tool Bar Controls. Is so, a very details help you can find in Excel Help. In Excel Help look for
About controls: when to use ActiveX or Forms toolbar controls
Originally Posted by toecutter
Regards
Maqbool
Hi,
For buttons from the Forms toolbox this should work.
VB:Sub Button1_Click() ' make buttons visible With ActiveSheet .Shapes("Button 2").Visible = True .Shapes("Button 3").Visible = True End With End Sub Sub Button2_Click() ' hide button then show form ActiveSheet.Shapes(Application.Caller).Visible = False UserForm1.Show End Sub Sub Button3_Click() ' hide button then show form ActiveSheet.Shapes(Application.Caller).Visible = False UserForm1.Show End Sub
Cheers
Andy
hi
Andy Pope, have made this code from your example.
but i get a error message when i use the 2nd commanbutton (cmdLeftAndRightFlashings)VB:Sub cmdRoofing_Click() ActiveSheet.cmdRoofing.Visible = True ActiveSheet.cmdRoofing.Visible = False ' hide ufmRoofing button ufmRoofing.Show End Sub Sub cmdLeftAndRightFlashings_Click() ActiveSheet.cmdLeftAndRightFlashings.Visible = True ActiveSheet.cmdLeftAndRightFlashings.Visible = False ' hide ufmLeftAndRightFlashings button ufmLeftAndRightFlashings.Show End Sub Sub cmdTopAndBottomFlashings_Click() ActiveSheet.cmdTopAndBottomFlashings.Visible = True ActiveSheet.cmdTopAndBottomFlashings.Visible = False ' hide ufmLeftAndRightFlashings button ufmTopAndBottomFlashings.Show End Sub Sub cmdBoxGutter_Click() ActiveSheet.cmdBoxGutter.Visible = True ActiveSheet.cmdBoxGutter.Visible = False ' hide ufmBoxGutter button ufmBoxGutter.Show End Sub Sub cmdNext_Click() ' make buttons visible With ActiveSheet .Shapes("cmdRoofing").Visible = True .Shapes("cmdLeftAndRightFlashings").Visible = True .Shapes("cmdTopAndBottomFlashings").Visible = True .Shapes("cmdBoxGutter").Visible = True End With End Sub
Run-time error '1004':
Not enought system resources to display completely.
if i end the error message the rest work fine!!
I added the ( ActiveSheet.cmdBoxGutter.Visible = True ) because the buttons properties kept changing to false so when i opend the sheet they where hidden.
any ideas?
cheers
toe
[edit] seems to be happining to any button i use the 2nd time.
Last edited by toecutter; January 19th, 2006 at 20:04.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks