Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Push button and input box?

I was wondering if anybody knows how to create a push button on a spreadsheet
that will then pop up something that the user can input a number and then it
will run a macro. Like basically i have a sub called DuplicateSheet (sheets
as integer) and i want it to ask the user how many sheets to duplicate then
it will run the script.

Thanks!!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Push button and input box?

Either:

View Toolbars Forms and draw the button from there or

Put any piece of ClipArt on the worksheet, right-click it, and assign the
macro.
--
Gary''s Student - gsnu200836


"tripflex" wrote:

I was wondering if anybody knows how to create a push button on a spreadsheet
that will then pop up something that the user can input a number and then it
will run a macro. Like basically i have a sub called DuplicateSheet (sheets
as integer) and i want it to ask the user how many sheets to duplicate then
it will run the script.

Thanks!!!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Push button and input box?

Option Explicit
Sub testme()

Dim HowMany As Long

HowMany = CLng(Application.InputBox(Prompt:="How many duplicates?", _
Type:=1))

'some validity checks
If HowMany < 1 _
Or HowMany 100 Then
MsgBox "Get Real!"
Exit Sub
End If

Call DuplicateSheet(HowManySheets:=HowMany)
End Sub

Sub DuplicateSheet(HowManySheets As Long)
MsgBox HowManySheets
End Sub

I wouldn't use Sheets as a variable (Excel's VBA has an object called Sheets).

And I wouldn't use "as integer". It's limited to smaller numbers and your
computer will convert it to a Long before it uses it anyway.


tripflex wrote:

I was wondering if anybody knows how to create a push button on a spreadsheet
that will then pop up something that the user can input a number and then it
will run a macro. Like basically i have a sub called DuplicateSheet (sheets
as integer) and i want it to ask the user how many sheets to duplicate then
it will run the script.

Thanks!!!


--

Dave Peterson
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
Time with the push of one button Dale G[_2_] New Users to Excel 7 August 6th 08 01:55 PM
Can excel have a button to input (stamp) the systems date and/or . abe Excel Worksheet Functions 5 April 24th 07 10:00 PM
Push button paste special? pugsly8422 Excel Discussion (Misc queries) 4 June 7th 06 03:26 PM
push button paste special pugsly8422 Excel Discussion (Misc queries) 2 June 7th 06 02:32 PM
when i push the "end" button the curser always goes to cell S47 leo Excel Discussion (Misc queries) 1 May 30th 06 09:01 PM


All times are GMT +1. The time now is 01:42 AM.

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"