Consulting

Results 1 to 4 of 4

Thread: Solved: Enter to days date on opening correct sheet

  1. #1
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location

    Solved: Enter to days date on opening correct sheet

    I have a workbook with seven sheets labeled "TUES,WED,THURS,FRI,SAT,SUN,MON" on opening this work book I would like to have todays date appear in collum A in the first empty row in the respective worksheet. IE: if the date was 14th Dec the date would appear in the first empty row in the worksheet labeled "FRI"

    Thanks for any help

  2. #2
    VBAX Mentor anandbohra's Avatar
    Joined
    May 2007
    Location
    Mumbai
    Posts
    313
    Location
    paste above code in your This workbook


    [VBA]Private Sub Workbook_Open()
    Dim a
    a = Weekday(Date)
    Select Case a
    Case 1
    Sheets("SUN").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 2
    Sheets("MON").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 3
    Sheets("TUES").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 4
    Sheets("WED").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 5
    Sheets("THURS").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 6
    Sheets("FRI").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date
    Case 7
    Sheets("SAT").Range("A65536").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(1, 0).FormulaR1C1 = Date

    End Select

    End Sub

    [/VBA]
    Always Mark your Thread as Solved the moment u got acceptable reply (located under Thread tools)
    Practice this & save time of others in thinking for unsolved thread

  3. #3
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location
    PERFECT MANY THANKS

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    An alternative

    [vba]

    Private Sub Workbook_Open()
    With Worksheets(Format(Weekday(Date), "ddd"))
    .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = Date
    End With
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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