Results 1 to 6 of 6

Thread: Combobox with Dynamic Date Range

  1. #1
    Senior Member
    Join Date
    Mar 2013
    Posts
    107
    Rep Power
    12

    Combobox with Dynamic Date Range

    Hello All

    I need to create a dynamic range for a Combo Box.The dynamic range will be for a series of dates.I need the date sequence to be always 7 days before todays date and 7 days after todays date.eg...using todays date as 21/7/2013 the list dates will start with 14/7/2013 and end with 28/7/2013...it will also need to update daily so as there is always 7 days before and after todays date

    If this is possible a excel file of how to achieve could it be posted please

    Best Regards

    Paul

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi Paul

    Please find attached the workbook. I hope this will find useful.
    Attached Files Attached Files
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Senior Member
    Join Date
    Mar 2013
    Posts
    107
    Rep Power
    12
    Hi Admin

    Yes that is very helpful.Thank you

    I tried to add your code to my sheet but it gives me errors. I think it is to do with Combobox versus checkbox...I changed but still gives me errors.

    I will want to add more lists to the other combobox on the form,,,,do I just add all the code in the userform code window

    What will I need to change to have your date sequence in the combobox for dates

    RegardsPaul
    Attached Files Attached Files

  4. #4
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi

    You only need the userform initialize code.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  5. #5
    Senior Member
    Join Date
    Mar 2013
    Posts
    107
    Rep Power
    12
    Thanks Admin...yes got it to know work...playing around with the code so as to learn for the rest of the userform

    My only other question I have is if I change the dates to a different numbered Combobox do I just change this line in the code

    Code:
    With Me.ComboBox1
    Example:So if I want the dates to appear in the combobox3 on my userform I change the code above from combobox1 to combobox3..The reason I ask is I have tried but it failed.I am learning as I go but I am changing the code as I think to work

    Paul

  6. #6
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    If you have multiple comboboxes, you can try

    Code:
    With Me
        With .ComboBox1
            .List = d
            .ListIndex = -1
        End With
        With .ComboBox3
            .List = d
            .ListIndex = -1
        End With
    End With
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 5
    Last Post: 06-15-2013, 12:40 PM
  2. Combobox Not Working In Excel Workbook Shared Mode
    By peter renton in forum Excel Help
    Replies: 15
    Last Post: 06-03-2013, 01:25 PM
  3. How to make Dynamic range (width) with OFFset function
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 12
    Last Post: 12-01-2012, 11:03 PM
  4. Combobox VBA update value worksheet
    By Tony in forum Excel Help
    Replies: 4
    Last Post: 10-28-2012, 12:28 AM
  5. Sum Ifs Formula needed with Max Date range
    By trankim in forum Excel Help
    Replies: 2
    Last Post: 09-19-2012, 09:50 AM

Tags for this Thread

Posting Permissions

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