Consulting

Results 1 to 9 of 9

Thread: VBA: Selecting and Copying Columns [more complex than it sounds]

  1. #1

    VBA: Selecting and Copying Columns [more complex than it sounds]

    okay so long story short is i need to transfer data from one excel sheet into another

    here is the scenario that i have if somebody could tell me if its possible/feasible or if there is another way to do so...

    there are a number of columns with data organized by headers [Weight, Mass, Height, Color, etc.]

    the user SELECTS a certain number of rows [say rows 2, 4, and 7]

    the user is then prompted for which pieces of data should be copied for ALL of these rows... whether this be through a checklist or drop down menu or anything organized

    for example, i would choose the Weight and Mass of rows 2, 4, and 7
    to be transferred into a new sheet with only the data for rows 2, 4, and 7 and their Weight and Mass

    is this possible? any help, suggestions, pointers, or solutions would be greatly appreciated. thank you in advance!

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    I don't know why you started another thread. http://www.vbaexpress.com/forum/showthread.php?p=250123

    In that other thread, you need to post an example so that you can get more help. You need to decide on a method for selecting columns. You could just Select the cells though which is easy and skips the need for a column selection. There are several methods to pick the columns to select. A Listbox with checkbox items would seem easy enough. A Userform is probably the best route. The Userform would be shown or set as modeless to allow selection of rows.

  3. #3
    how do you go about creating a Listbox or Userform? this system would be less for small sets of data and more for large sets instead where picking out the cells individually would be a hassle and also pasting them into a new sheet one by one

  4. #4
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location

    Try this

    Try this out
    Attached Files Attached Files

  5. #5
    thats perfect! how did you implement the checkboxes??

  6. #6
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    easiest, just put the spreadsheet into DESIGN mode and do a copy and paste - making sure they are in sequential order! Otherwise, the wrong column will be selected and your destination will get screwed up.

  7. #7
    thank you to both of you!

  8. #8
    last question @JKwan: is there anyway to put that [or something like it] into VBA code?

  9. #9
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    Quote Originally Posted by jlkamikaze
    last question @JKwan: is there anyway to put that [or something like it] into VBA code?
    I don't understand, what I gave you is VBA codes..... Unless you don't want the Checkboxes on the spreadsheet and use a form, is this what you are referring?

Posting Permissions

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