Thread: User Form
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default User Form

The easy way is to put a commandbutton from the Forms toolbar onto every
sheet where you would like it to function. When it asks you to specify the
macro choose "New..." and you can type the code in the button's _Click
procedure.

The other method, using a single toolbar button, is to insert a module and
add the code in a Public Sub, e.g:
Public Sub ShowMyForm()
UserForm1.Show
End Sub

Then right-click somewhere on your toolbar. Choose "Customize" and in the
dialog go to the tab that says "Commands." If you choose Macros in the
Categories List you will see on the right an option for "Custom Button"
(smiley face). Drag the smiley onto your toolbar, then (with the Customize
dialog still showing) right-click the smiley and choose "Assign Macro..." -
here you should be able to see your ShowMyForm macro in the list, so assign
it to the button. Then whenever the user presses that button the UserForm
should show allowing the selection of another sheet. You can customize this
option even further but this should be enough to at least get you going, I
hope.
--
- K Dales


"Discovery" wrote:


But how can I put the code in the worksheet?

Thanks,
Discovery


--
Discovery
------------------------------------------------------------------------
Discovery's Profile: http://www.excelforum.com/member.php...o&userid=25859
View this thread: http://www.excelforum.com/showthread...hreadid=392433