+ Reply to Thread
Results 1 to 8 of 8

Create "print array" button

  1. #1
    Registered User
    Join Date
    04-28-2010
    Location
    Ny, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Create "print array" button

    Hello all, could use some help here...

    I have an Excel workbook with 10 tabs or so. One tab is a "Print" worksheet. On this worksheet, I have created two buttons in VB -one is "Print Results Only", and the other is "Print Questionaire and Results." The latter is giving me trouble...

    Please Login or Register  to view this content.
    Can anyone point out the problem?! I am getting an error that says "Runtime error (9) ... Subscript out of range." All of the names are an exact match, so i can't figure out the problem.
    Last edited by davidshluger; 04-28-2010 at 05:40 PM. Reason: Post was inconsistent with forum rules (added CODE tags)

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Create "print array" button

    Welcome to the forum.

    Please take a few miinutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-28-2010
    Location
    Ny, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Create "print array" button

    I appologize shg, thanks for your help. I did not mean to be an inconsiderate forum user and would genuinely appreciate some assistance. I have been searching extensively for a fix on this and saw a couple that were close (ironically fixed by you!) but not close enough for my unsophisticated abilities. Any ideas?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create "print array" button

    That error would cause me to suspect the sheet names. I know you said they all exist, but spelling counts, and the most common stumble for me is a hidden space somewhere in one of the sheetnames.

    Try removing all but one sheet from your array, and then test. If it works, add another sheet to the array and test...etc. At some point you'll add a sheet and it won't work and now you'll know where you have to look.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    04-28-2010
    Location
    Ny, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Create "print array" button

    Wow that did it! I feel silly but there was indeed a space after a bunch of the tab titles. Thanks! Ok let's see if I can stump you with this...

    I made a spin button and linked it to cell c24. The idea is use cell c24 as an input value for the number of copies to print from the print button. Follow? This is what I tried, without it working...
    Please Login or Register  to view this content.
    Any idea how to make Copies = [value in c24] ???

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create "print array" button

    Like so:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-28-2010
    Location
    Ny, NY
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Create "print array" button

    I didn't explain that right. Cell C24 is a number on the active sheet, but the sheet to be printed is a seperate worksheet. I am very proud to say that with your help I fixed it myself using the following:


    Please Login or Register  to view this content.
    Worked like a charm. Thanks for all your help!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Create "print array" button

    As a matter of habit, you want to make sure you edit out any Selecting going on your macros. You see that because you're starting with recorded code, we all do that, but you need to edit it back out again.

    Please Login or Register  to view this content.
    ....or maybe:
    Please Login or Register  to view this content.
    ...or list the sheet directly:
    Please Login or Register  to view this content.
    ==========
    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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