+ Reply to Thread
Results 1 to 4 of 4

Searching Columns for a particular month then moving data from that column to User Form

  1. #1
    Registered User
    Join Date
    11-15-2013
    Location
    U.S.A
    MS-Off Ver
    Excel 2010
    Posts
    24

    Searching Columns for a particular month then moving data from that column to User Form

    Hi all,

    I need some help. I have an excel spreadsheet where the columns have the 12 months of the year in Row 1. What I need is code that will find the month (from the column) which I select (via a listbox in a userform) and then go down that column and move the data that corresponds to that month to the userform.

    So, If I select January from my userform, all data below January will then be moved to the userform and the same thing will occur with each month I select. I know how to move the data from the sheet to the userform, I just don't know how to match my data with the selected month.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Searching Columns for a particular month then moving data from that column to User For

    If your Months start from Column "A" = "January", then this code will give you the related Month column from the list box Month Selected.

    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    11-15-2013
    Location
    U.S.A
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Searching Columns for a particular month then moving data from that column to User For

    Hi MickG,

    Your code works but it does not do what I need.
    What I have is the following:

    Column "B" is January
    Column "D" is February
    Column "F" is March and so on...

    What I need the code to do is to find the month I select using the listbox in the UserForm then move the item below the column where the month is to the UserForm.

    Example:
    If in my listbox I select March my code will search "Row 1" until it finds March, then it will go down that Column (the March column) and move the items in the March column (in this case numbers) to the proper location within the UserForm. If I select January the same thing will occur and so on. I hope I am clearer this time. Thanks for your help.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Searching Columns for a particular month then moving data from that column to User For

    IF your Months columns start in Column "B" and are set in every other column then you can still use the Code by adding 2 to the end as below.
    This will be your column "Number" relating to the Month selected.
    This code will select that month and Copy the range below Row1 of that month to Listbox2.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. User form to add data in next row in column range
    By akarlsson78 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-13-2013, 04:26 AM
  2. Data Update after using a searching function user form
    By yontyont in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-08-2013, 12:45 AM
  3. Searching a customer database with VBA and a User Form
    By dsanders1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2010, 09:29 AM
  4. Moving User Form Caption
    By LoveCandle in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-20-2010, 10:12 AM
  5. Searching in a user form / List box
    By Idokras in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2005, 12:23 PM

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