Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: Select Sheets For Specific Date By Clicking On A Calendar

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    14
    You don't have to scroll down if you sort the list with the latest sheet on top.
    You could also consider to select the item that matches today's date, because I assume that sheet will be needed most.

    Code:
    Private Sub Workbook_Open()
        c00 = [text(today(),"'ddd, mmm dd, yyyy'")&"!A1"]
        If Not Evaluate("isref(" & c00 & ")") Then Sheets.Add.Name = [text(today(),"ddd, mmm dd, yyyy")]
        
        For Each sh In Sheets
            If InStr(sh.Name, ",") > 0 Then c01 = c01 & vbLf & sh.Name
        Next
        Sheets("index").ListBox1.List = Split(Mid(c01, 2), vbLf)
        
        Sheets("index").ListBox1.Value = [text(today(),"ddd, mmm dd, yyyy")]
    End Sub
    The advantage of this approach compared to the use of a datepicker is that only available sheets will be shown in the listbox. So it's not possible to select a non-existing sheet. The datepicker approach would require all sorts of checks & messages if a sheet doesn't exist.
    Last edited by snb; 05-16-2013 at 05:56 PM.

Similar Threads

  1. Replies: 5
    Last Post: 06-15-2013, 12:40 PM
  2. Replies: 3
    Last Post: 06-10-2013, 06:12 PM
  3. Replies: 4
    Last Post: 06-10-2013, 01:27 PM
  4. Replies: 3
    Last Post: 05-17-2013, 01:22 PM
  5. Replies: 0
    Last Post: 02-27-2012, 01:07 AM

Posting Permissions

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