Results 1 to 20 of 27

Thread: UserForm to Return the MAX date in a TextBox resulting from VLOOKUP in ComboBox

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Regular
    Joined
    Jun 2005
    Posts
    95
    Location
    p45cal,

    I made the changes and now I am no loner getting the errors but it also is not pulling in any date in the ApptDateTextBox. I am posting all of the code I have so far. I have this entered in the UserForms SchoolNameComboBox_Change Event, is that correct?

    Private Sub SchoolNameComboBox_Change()
    Dim SchoolNames  As Variant
    Dim SchoolDays As Variant
    Dim i As Long
    Dim MaxDate As Date
    Dim ThisName As String
    ThisName = SchoolNameComboBox
    With Worksheets("Future Appointments")
          SchoolNames = Intersect(.Range("A2").CurrentRegion, .Range("A:A"))
          SchoolDays = Intersect(.Range("F2").CurrentRegion, .Range("F:F"))  'Edit to fit
    End With
    For i = LBound(SchoolNames) + 1 To UBound(SchoolNames) '+1 to skip headers
          If SchoolNames(i, 1) = ThisName Then MaxDate = Application.Max(MaxDate, SchoolDays(i, 1))
    Next i
    'If MaxDate = 0 then No Match found
    End Sub
    Thank you for your help!
    Last edited by Aussiebear; 04-21-2023 at 06:36 PM. Reason: Reduced the whitespace

Posting Permissions

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