+ Reply to Thread
Results 1 to 14 of 14

Amending code based on cell value

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Amending code based on cell value

    hi guys
    im a little bit stuck i have this code ( straight forward enough )
    HTML Code: 
    but i would like the line completion sheet to printout copies based on whats in cell h12 of working sheet

    so if h12 has a 3 in it it prints out 3 copies

    is this possible?
    thanks in advance

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    re: Amending code based on cell value

    I was not sure what you meant by working sheet so I have assumed it is the sheet name

    Please Login or Register  to view this content.
    If it is the Active sheet then change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: Amending code based on cell value

    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    hi mudraker

    working sheet is the sheet all the data is put into
    ie name
    address
    etc etc

    and then i have a sheet called completion sheet which would need to print the number of copies based on cell h12 in working sheet
    i thnk that will be your top answer

    thanks

  5. #5
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    hi mudraker
    its not doing as id hoped
    i have attached it

    so if cell h12 ( in yellow) has 3 in it i need it to print 3 copies of completionsheet and if it says 20 it needs to print 20

    thanks for your help
    Attached Files Attached Files

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: Amending code based on cell value

    doesnt it have to be an xlsm?

  7. #7
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    Hi martin
    the workbook has several other macros in it
    so i guess it does

  8. #8
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    here is the trial as a xlsm
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    think this should be in programming if a mod would be kind enough to move it for me

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: Amending code based on cell value

    that code works fine i assigned button one to Sub Button1_Click() macro and away it went

  11. #11
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    maybe i need to try it at work as my printers isnt working so im checking the print queue and it says 1 page

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: Amending code based on cell value

    ps i now have several sheets with just "hello" on if anyone wants them lol

  13. #13
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    re: Amending code based on cell value

    lol thanks martin
    so if you change it to just 1 it only prints one copy?

    Quote Originally Posted by martindwilson View Post
    ps i now have several sheets with just "hello" on if anyone wants them lol

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: Amending code based on cell value

    yep
    ps i now have another sheet with hello on it!!!!!!!

+ 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