+ Reply to Thread
Results 1 to 9 of 9

Need to input value then repeat a process until value exhausted

  1. #1
    Registered User
    Join Date
    12-02-2011
    Location
    Edinburgh
    MS-Off Ver
    MS Office 365 (Word, Excel, Powerpoint, Publisher)
    Posts
    23

    Need to input value then repeat a process until value exhausted

    I have a worksheet that is constantly updated with data. I need to take this new data and paste it into another worksheet. I have managed to sort that but what I need to do is for there to be a prompt asking for the start row, end row and date, let's say 100, 109, Monday 23/2/13

    I then need the date pasted into sheet 1 cell h1:n3, font size 28. This does not change.

    Then I need row 100 from sheet 2 selected. The following would be executed.

    Please Login or Register  to view this content.
    I then need this to print.

    Then I need the next row in sheet 1 to be selected (row 101) and for the same process to repeat and so on until the end row has printed (row 109).

    Any help greatly appreciated.
    Last edited by BigMcBen; 02-09-2013 at 05:50 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: I know what I want to do, just not how to say it in code

    Hi, BigMcBen,

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need to input value then repeat a process until value exhausted

    Try this.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-02-2011
    Location
    Edinburgh
    MS-Off Ver
    MS Office 365 (Word, Excel, Powerpoint, Publisher)
    Posts
    23

    Re: Need to input value then repeat a process until value exhausted

    Wow Alphafrog, that is amazing. The only slight glitch is that when the date is inputted, they sometimes specify the day as well, so it could be Monday 11/2/13. If assuming that d As Date makes the program look only for a date so when I add a day it come up as an error. How would I fix this?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need to input value then repeat a process until value exhausted

    How would I fix this?
    The easiest fix is don't do that.
    Just change the Input box prompt to state the proper date entry format.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-02-2011
    Location
    Edinburgh
    MS-Off Ver
    MS Office 365 (Word, Excel, Powerpoint, Publisher)
    Posts
    23

    Re: Need to input value then repeat a process until value exhausted

    Ok, I've done as you suggested and there is already today's date offered in the box, but it is american format m/d/yy. Is it possible to make it either uk format or not appear at all?

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need to input value then repeat a process until value exhausted

    Remove the date:
    Please Login or Register  to view this content.
    Date as UK format:
    Please Login or Register  to view this content.
    You're welcome.

  8. #8
    Registered User
    Join Date
    12-02-2011
    Location
    Edinburgh
    MS-Off Ver
    MS Office 365 (Word, Excel, Powerpoint, Publisher)
    Posts
    23

    Re: Need to input value then repeat a process until value exhausted

    I'm trying to understand what you've written. One glitch that came up was that if you selected say rows 2 and 4, you would print out three pages but what you'd written subtracted 4-2 which gave 2 so I added + 1 to the line and it works, so I'm increasing my knowledge at the same time. I don't think many people actually appreciate just how powerful a tool Excel is and the amazing things you can automate and achieve. Another couple of points if I may. If I wanted to avoid any doubt as to the worksheet to start from, instead of Set ws = ActiveSheet, would I write Set ws = Sheets ("Scotland"), which is the name of the worksheet? Also the system I'll be using it on may have more than one printer. Can I modify the .Printout Copies:=1 to specify the printer address and if so, how?

    Again thanks for all of your help and patience.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need to input value then repeat a process until value exhausted

    Quote Originally Posted by BigMcBen View Post
    would I write Set ws = Sheets ("Scotland"), which is the name of the worksheet? Also the system I'll be using it on may have more than one printer. Can I modify the .Printout Copies:=1 to specify the printer address and if so, how?
    Good catch on the rows count.

    Yes on the set ws..., but you'll never really know until you try it.

    Set the path and printer name to suit.
    ActiveSheet.PrintOut Copies:=1, ActivePrinter:="\\print_server\printer_name"

    Tips for getting VBA code help:
    • In the VBA editor, highlight a key word (e.g. Printout) and press the F1 key to get the description, syntax, and arguments of the command (and sometimes example code).
    • Record a macro to get example code
    • Do a web search for something like Excel VBA select printer
    • Or do a Google search for this specific forum like this; select printer site:http:// www.Excelforum.com .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1