couldnt you just delete it?
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
Last edited by toecutter; January 19th, 2006 at 14:08.
Originally Posted by Maqbool
correct me if iam wrong.
on a xls sheet there is 2 options for forms?
1: CONTROL TOOLBOX
these 2 options do not include the VBA forms?
Last edited by toecutter; January 19th, 2006 at 16:49.
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
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
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.
 seems to be happining to any button i use the 2nd time.
Last edited by toecutter; January 19th, 2006 at 21:04.
There are currently 1 users browsing this thread. (0 members and 1 guests)