1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VBA code for Excel

Discussion in 'Business Applications' started by Keebellah, Mar 30, 2008.

Thread Status:
Not open for further replies.
  1. Keebellah

    Keebellah Trusted Advisor Thread Starter

    Joined:
    Mar 27, 2008
    Messages:
    6,608
    First Name:
    Hans
    Hi, I'm new to this forum.
    I was looking for different dialog options and VBA code for my Excel sheets when I came upon the Printer.Dlg code where you can choose the sheet you want to print.
    I have altered the code in such a manner that you can use the checkboxes to select one or more items from a specific range in any sheet and whereever it is located.
    If there is anyone intersetd I will post it.
    What is does is you call the function giving the sheetname, column letter, starting rownumber and endding rownumber:
    Call SelectFromList("Sheet3", "D" , 5, 25)
    This will result in a Dialog screen with a list of 20 values in the range which you can select and then write that part of the code you need that does something with this.
    The code allows any number of rows, The max per dialog screen is 200 spread over 4 columns of 50.
    It was fun to do.
    I am beginning to like VBA routines in my Excel sheets thus permitting users to enter only that data which is requested of making only the permitted selections.

    Thanks for the attention.

    Cheers,

    Hans
     
  2. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    Hi, since you started this, please do post your code so if someone else comes looking for such a solution they can find it.
    I would suggest that you check out this site also - it's a great place for coders and several of the other who post here regularly also haunt it (in fact, one of the people who manages it, who goes by firefytr, is also a regular here)
    http://www.vbaexpress.com/forum/index.php
     
  3. Keebellah

    Keebellah Trusted Advisor Thread Starter

    Joined:
    Mar 27, 2008
    Messages:
    6,608
    First Name:
    Hans
    You're right,
    I have attached the code, it's in the attachment XSelectFromListModule.zip.

    Just import it as a module in any excel sheet and call the function SelectFromList with parameters.
    There are 4 optional parameters:
    tSheet = the name of the sheet containing the list of names / files, whatever
    tRange = the column e.g A, B, C, ..... Y, Z, AA
    tRow = the row where the list starts, default is 2
    tEndRow= the last row in the list, if left blank the range will search for the last row filled

    In my test here I am stille busy with an additional parameter where you can call the procedure or function you wish to exceute with the made choice.

    Like I said this code is based upon code I found via Google and adapted to my needs. Try it and all comments and corrections are welcome.

    Cheers,
    Hans
     

    Attached Files:

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/698511

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice