+ Reply to Thread
Results 1 to 6 of 6

Calendar Drop-Down Help

  1. #1
    Registered User
    Join Date
    10-07-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Calendar Drop-Down Help

    I have the following code in my spreadsheet and it is working great:

    Private Sub Calendar1_Click()
    ActiveCell.Value = CDbl(Calendar1.Value)
    ActiveCell.NumberFormat = "mm/dd/yyyy"
    ActiveCell.Select
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Application.Intersect(Range("d3:e19, g3:h19, j3:k19, m3:n19, p3:q19, s3:t19, v3:w19, y3:z19, ab3:ac19, ae3:af19, ah3:ai19, ak3:al19, an3:ao19, aq3:ar19, at3:au19, aw3:ax19, az3:ba19, bc3:bd19, bf3:bg19, bi3:bj19, bl3:bm19"), Target) Is Nothing Then
    Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    Calendar1.Top = Target.Top + Target.Height
    Calendar1.Visible = True
    ' select Today's date in the Calendar
    Calendar1.Value = Date
    ElseIf Calendar1.Visible Then Calendar1.Visible = False
    End If
    End Sub
    My problem is that this spreadsheet is a running one that is tracking the progress of numerous functions and tasks. I need to add rows to this spreadsheet every so often so that it will go past row 19. (As an aside, my data only goes to row 18 right now. Row 19 is blank and hidden so that some average and st dev calculations can be run at the bottom of the columns. I do this so that when I add a row, I do so above row 19 and these calculations automatically update the affected cells. Not sure if this is pertinent to my problem).

    Is there a way to add a modifier to this code that will automatically update the rows past 19 without me having to go into the source and update all the columns manually?
    Last edited by XCRP83X; 10-08-2010 at 08:17 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Calendar Drop-Down Help

    You could use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    Last edited by antoka05; 10-07-2010 at 11:34 AM.

  3. #3
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Calendar Drop-Down Help

    Welcome to the forum!

    If you change your tag in your message from to
    Please Login or Register  to view this content.
    , it can be read better.

    Questions:
    Where are you average and st dev calcs located? Are they in row 20?
    How do you add a row?

    If there is always a blank row between your data and the average and stdev calcs. You can use the following to capture the number of the last nonblank row
    Please Login or Register  to view this content.
    This can be used to build the range text string that you have as your Intersect argument.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

  4. #4
    Registered User
    Join Date
    10-07-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Calendar Drop-Down Help

    Thank you for the welcome and quick help!

    My average and standard dev rows are in 20 and 21, respectively. I add a row by clicking in row 19 and adding. This updates my calculations in average and std dev automatically. If there is a better way to do this, I'd love to know.

    The rest of my spreadsheet is set up such that rows 3-18 have drop-down calendars. There are two columns of these in the same rows (one for start date and one for end date) that are summed in a 3rd column as a networkdays function. The networkdays function is what I use for my average and std dev calculations.

    Basically, I have projects in my rows. I have start and end days in columns with a third column for networkdays sum. This networkdays has an average and std dev in the two rows below my project rows. This set up is done about 20 times across the columns in my spreadsheet.

    As the year progresses, I will need to add more than 18 rows of data. As soon as I get past row 18, my macro for the drop down calendar needs to be manually updated column by column to account for the new row.

    I would be happy to edit my spreadsheet in whatever manner you think is best to accomplish what I am trying to do.

  5. #5
    Registered User
    Join Date
    10-07-2010
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Calendar Drop-Down Help

    Here is a link to a screenshot of my spreadsheet with some quick definitions if it helps:

    http://img696.imageshack.us/img696/5350/myspdsht.jpg

  6. #6
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Calendar Drop-Down Help

    Try this. Remember that the row before the calculations must be blank.
    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)

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