+ Reply to Thread
Results 1 to 3 of 3

Calendar / Date Picker - Only Choose Sunday

Hybrid View

  1. #1
    Registered User
    Join Date
    02-02-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Calendar / Date Picker - Only Choose Sunday

    I have been racking my brain, trying to figure out a technique for this..

    I am working on an expense form and need a way for the salesman to only select Sunday from the calendar or date picker.
    Or even a way for the for the salesman to input any date, and it chooses the beginning Sunday of the week.
    For example, if they input "2/2/2016" , it would change to "1/31/2016".

    I hope that all makes sense. I can provide images, if necessary.

    Thank you for your help!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Calendar / Date Picker - Only Choose Sunday

    Why dont you use a simple Userform?

    Click on Cell B3 of the attached spreadsheet.

    
    Private Sub SpinButton1_Change()
    Range("A1").Value = SpinButton1.Value
    
    TextBox1.Value = SpinButton1.Value
    End Sub
    
    Private Sub UserForm_Activate()
    MArray = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
    TextBox1.Value = Year(Date)
    
    ComboBox1.List = MArray
    t = Month(Date) - 1
    ComboBox1.ListIndex = t
    Temp = 5
    
    SpinButton1.Value = 2016
    
    MyDate = CDate("01/" & ComboBox1.Value & "/" & TextBox1.Value)
    DaysMonth = Day(DateSerial(Year(MyDate), Month(MyDate) + 1, 1) - 1)
    Mdate = Weekday(MyDate, vbSunday)
    
    Daycount = 1
    
    EndDate = Application.EoMonth(Weekday("01/" & ComboBox1.Value & "/" & TextBox1.Value, vbSunday), 0)
    
    If Mdate <> 1 Then Daycount = 8 - Mdate
       
    DayLoop:
    
    ComboBox2.AddItem Daycount
    
    Daycount = Daycount + 7
    
    If Daycount < DaysMonth Then GoTo DayLoop
    
    ComboBox2.ListIndex = 0
    
    End Sub
    
    Private Sub UserForm_Terminate()
    Range("B3").Value = ComboBox2.Value & "/" & ComboBox1.Value & "/" & TextBox1.Value
    End Sub
    Attached Files Attached Files
    Last edited by mehmetcik; 02-02-2016 at 06:56 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-02-2016
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Calendar / Date Picker - Only Choose Sunday

    Quote Originally Posted by mehmetcik View Post
    Why dont you use a simple Userform?
    I appreciate your reply, Mehmetcik.

    My apologizes - I am fairly new to Excel. Most of my knowledge has been from Googling questions.

    How would you recommend that I use the Simple Userform?
    From my research, it looks like I would need it to pop-up and then have a calendar on it for them to select from? Is there a way to have the calendar gray-out every date, except for Sunday?

    Is that correct?

+ 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. Adding Date picker to a cell (a calendar popup)
    By theglitch in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2015, 08:01 AM
  2. Date Picker / Calendar for Combobox
    By sthiru in forum Excel General
    Replies: 9
    Last Post: 11-24-2015, 04:30 PM
  3. How to add a date picker / Calendar from clicking a cell
    By RichardJSigKits in forum Excel General
    Replies: 6
    Last Post: 02-09-2013, 12:52 PM
  4. [SOLVED] Calendar Option in the user form - date picker
    By skhari in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2012, 02:46 AM
  5. Replies: 3
    Last Post: 09-06-2010, 02:31 PM
  6. Replies: 1
    Last Post: 07-11-2005, 08:05 AM
  7. [SOLVED] Creating a calendar in a cell for a date-picker
    By MarkieE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-25-2005, 09:06 PM

Tags for this Thread

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