+ Reply to Thread
Results 1 to 52 of 52

Change Roster values

Hybrid View

  1. #1
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    Everything running beautiful! Thanks heaps.

    I have done a lot since last post. Main thing is I created custom forms for each of the sheets. All forms have date text boxes. I like it to be like the Modify Form. What is the code so that the calender places the entry to the textbox enter event? Can I call the same Calender for seperate forms or do I need multiple calender in each form?

    Can I just copy and paste this code:
    Private Sub TextBox1_Change()
            Dim myName As String
            sYear = Year(Me.TextBox1.Value)
            sMonth = WorksheetFunction.Text(Me.TextBox1.Text, "mmm")
            Set ws1 = Sheets("Roster2012")
            With ws1
                Set myRng = .Range(sMonth & "_" & sYear)
                myName = Me.ComboBox1.Value
                myDate = Format(Me.TextBox1.Value, "dd/mm/yyyy")
                Set myCol = myRng.Rows(1).Find _
                        (what:=DateValue(myDate), LookIn:=xlFormulas)
    
                On Error Resume Next
                Set myRow = .Columns(1).Find(what:=myName, After:=.Cells(myRng.Rows(1).Row, 1), LookIn:=xlValues, LookAt:= _
                        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
                        , SearchFormat:=False)
                On Error GoTo 0
                If Not myRow Is Nothing Then    'Application.Goto myRow, True
                    Me.TextBox2.Value = Intersect(myRow.EntireRow, myCol.EntireColumn).Value
                End If
            End With
        End If
        EventsOff = False
        SendKeys "{TAB}"
    End Sub
    The date format should be dd/mm/yy when inserted in textbox field.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Regarding this
    Can I call the same Calender for separate forms
    Yes

    Regarding this
    Can I just copy and paste this code
    If your UserForm models the Modify Form, I should think so...may take a bit of tweaking but the code would be substantially the same.

    However, if you're ADDING records to the Target Worksheet, while the Calendar Control will be the same and can be called in the same way, you'll need to develop the code to post the ADDED data to the Target worksheet.

    Good luck!
    Last edited by jaslake; 04-19-2012 at 09:13 AM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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