Hi All,
I have a copy/paste macro which adds one line to several sheets. I am trying to build code to allow a user to enter a number by input box which will call my copy/paste macro x times until the number of lines matches the number entered by the user. I have used a countif function to determine how many rows in a cell in my worksheet but am not sure how to assign this number to be compared with the number inputed by the user in the input box.
Your help is greatly appreciated.
Best,
Mel
Hello magito,
Welcome to the Forum!
If you have a macro written then you should post the code. This will help in developing a workable solution.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi magito
Welcome to the Forum. Please post at least the code you have...a sanitized workbook would be better. This'll give us a clearer picture of what you'd like to accomplish.
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Thanks for your responses - The code for my macro is below. Essentially what I am trying to do is to add code to create an input box which will allow a user to enter the number of times the code below will repeat itself. The template has two lines to start with (on 3 worksheets) so the result I am seeking is for the macro to run the number of times entered minus 2 so the number of lines will equal the number entered.
I am confused on how to compare the input value with the value of the counter in my spreadsheet which is a countif function. I think this can be accomplished with an if then statement which determines if the macro should end or call the sub in the code below to add another row.
Thanks in advance for your help
Application.Goto Reference:="Input_Add" Selection.Insert Shift:=xlDown Application.Goto Reference:="Class_Sample" Selection.Copy Application.Goto Reference:="Class_add" Selection.Insert Shift:=xlDown Application.Goto Reference:="Acct_Sample" Application.CutCopyMode = False Selection.Copy Application.Goto Reference:="Acc_Add" Selection.Insert Shift:=xlDown Application.Goto Reference:="Input_Add" End Sub
Last edited by Leith Ross; 07-09-2011 at 09:19 PM. Reason: Corrected Code Tag
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks