PC Review


Reply
Thread Tools Rate Thread

Adding User Dialog to Macro

 
 
JAD
Guest
Posts: n/a
 
      28th Oct 2008
I have a macro that when activated will add (3) rows to a section of the
worksheet. To enhance flexibility, I would like to interrupt the macro to ask
the end user how many rows they would like to insert, set the macro to the
user number and complete the macro process. The following is the automated
macro that inserts the (3) rows automatically. Any help would be appreciated.
Thank You, JAD


Call Security_Unprotect
Application.Goto Reference:="Me02_END"
ActiveCell.Offset(0, 0).Range("a1:a3").Select
Selection.EntireRow.Insert
ActiveCell.Offset(0, 0).Range("a1").Select
ActiveWorkbook.Names.Add Name:="Me02_NEW_START", RefersToR1C1:=ActiveCell
Application.Goto Reference:="Me_COPY"
Selection.Copy
Application.Goto Reference:="Me02_NEW_START"
ActiveSheet.Paste
Application.Goto Reference:="MM_EQ_Menu_Selection"
Call Security_Protect
End Sub
 
Reply With Quote
 
 
 
 
Michael
Guest
Posts: n/a
 
      28th Oct 2008
If you know you will always input on the top row meaning A1, then all you
need to use is the Input Function.

myNum = Application.InputBox("Enter a number")
Then susbtitute the variable MyNum in your code
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"JAD" wrote:

> I have a macro that when activated will add (3) rows to a section of the
> worksheet. To enhance flexibility, I would like to interrupt the macro to ask
> the end user how many rows they would like to insert, set the macro to the
> user number and complete the macro process. The following is the automated
> macro that inserts the (3) rows automatically. Any help would be appreciated.
> Thank You, JAD
>
>
> Call Security_Unprotect
> Application.Goto Reference:="Me02_END"
> ActiveCell.Offset(0, 0).Range("a1:a3").Select
> Selection.EntireRow.Insert
> ActiveCell.Offset(0, 0).Range("a1").Select
> ActiveWorkbook.Names.Add Name:="Me02_NEW_START", RefersToR1C1:=ActiveCell
> Application.Goto Reference:="Me_COPY"
> Selection.Copy
> Application.Goto Reference:="Me02_NEW_START"
> ActiveSheet.Paste
> Application.Goto Reference:="MM_EQ_Menu_Selection"
> Call Security_Protect
> End Sub

 
Reply With Quote
 
Michael
Guest
Posts: n/a
 
      28th Oct 2008
You can also try something like this:
MyNum = Application.InputBox("Enter a number")
For i = 1 To MyNum
Range("A1").EntireRow.Insert
Next i
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"JAD" wrote:

> I have a macro that when activated will add (3) rows to a section of the
> worksheet. To enhance flexibility, I would like to interrupt the macro to ask
> the end user how many rows they would like to insert, set the macro to the
> user number and complete the macro process. The following is the automated
> macro that inserts the (3) rows automatically. Any help would be appreciated.
> Thank You, JAD
>
>
> Call Security_Unprotect
> Application.Goto Reference:="Me02_END"
> ActiveCell.Offset(0, 0).Range("a1:a3").Select
> Selection.EntireRow.Insert
> ActiveCell.Offset(0, 0).Range("a1").Select
> ActiveWorkbook.Names.Add Name:="Me02_NEW_START", RefersToR1C1:=ActiveCell
> Application.Goto Reference:="Me_COPY"
> Selection.Copy
> Application.Goto Reference:="Me02_NEW_START"
> ActiveSheet.Paste
> Application.Goto Reference:="MM_EQ_Menu_Selection"
> Call Security_Protect
> End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding user defined range in macro Jacky D. Microsoft Excel Programming 2 19th May 2009 05:38 PM
How do I give the user a File Open dialog on transferText macro? =?Utf-8?B?USBKb2huc29u?= Microsoft Access Macros 1 9th May 2006 10:57 PM
Macro to pause for user input in dialog box =?Utf-8?B?a2F5YWJvYg==?= Microsoft Excel Misc 1 22nd Jun 2005 07:49 PM
Adding Autotext in a Macro User Form field =?Utf-8?B?T25rYQ==?= Microsoft Word Document Management 1 10th Feb 2005 05:39 AM
control of dialog macro dialog box. on open Gerry Abbott Microsoft Excel Programming 0 22nd Jul 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:55 AM.