+ Reply to Thread
Results 1 to 3 of 3

Use of Today() and change data type

  1. #1
    Dale
    Guest

    Use of Today() and change data type

    Hi all


    How would I insert the date into a cell (programatically) then change its
    data type to text.
    Currently, when I open the file days later, of course, Excel populates the
    cells with the current date.
    My desired end result is subsequent openings will display the date the cell
    was originally populated. (Needs to stay the same always.)

    Does anyone have a better idea how to do this?


    I have the following


    With oExcel
    .Range("L1").Select
    .Selection.NumberFormat = "General"
    .ActiveCell.FormulaR1C1 = "WorkOrder"
    .Range("L2").Select
    .ActiveCell.FormulaR1C1 = z
    .Range("L3").Select
    .ActiveCell.FormulaR1C1 = z
    .Range("L2").Select
    .Selection.AutoFill Destination:=.Range("L2:L3"), Type:=xlFillDefault
    .Range("L2:L3").Select
    ' .Selection.AutoFill Destination:=.Range("L2:L99"), Type:=xlFillDefault
    .Selection.AutoFill Destination:=.Range("L2:L" & DATAcount + 1),
    Type:=xlFillDefault

    ' .Range("L2:L99").Select

    .Range("M1").Select
    .Selection.NumberFormat = "@" '"General"
    .ActiveCell.FormulaR1C1 = "DateRun"
    .Range("M2").Select
    .ActiveCell.FormulaR1C1 = "=TODAY()"
    .Range("M3").Select
    .ActiveCell.FormulaR1C1 = "=TODAY()"
    .Range("M2:M3").Select
    .Selection.AutoFill Destination:=.Range("M2:M" & DATAcount + 1),
    Type:=xlFillDefault
    ' .Range("M2:M99").Select
    ' .ActiveWindow.LargeScroll Down:=-2
    ' .ActiveWindow.LargeScroll ToRight:=-1
    .Range("N1").Select
    ' .ActiveWorkbook.Save
    .ActiveWorkbook.Close SaveChanges:=True


    End With


    Regards
    Dale



  2. #2
    STEVE BELL
    Guest

    Re: Use of Today() and change data type

    Dale

    Range("G14") = Date

    inputs a static date = today

    --
    steveB

    Remove "AYN" from email to respond
    "Dale" <D-Man> wrote in message
    news:[email protected]...
    > Hi all
    >
    >
    > How would I insert the date into a cell (programatically) then change its
    > data type to text.
    > Currently, when I open the file days later, of course, Excel populates the
    > cells with the current date.
    > My desired end result is subsequent openings will display the date the
    > cell was originally populated. (Needs to stay the same always.)
    >
    > Does anyone have a better idea how to do this?
    >
    >
    > I have the following
    >
    >
    > With oExcel
    > .Range("L1").Select
    > .Selection.NumberFormat = "General"
    > .ActiveCell.FormulaR1C1 = "WorkOrder"
    > .Range("L2").Select
    > .ActiveCell.FormulaR1C1 = z
    > .Range("L3").Select
    > .ActiveCell.FormulaR1C1 = z
    > .Range("L2").Select
    > .Selection.AutoFill Destination:=.Range("L2:L3"), Type:=xlFillDefault
    > .Range("L2:L3").Select
    > ' .Selection.AutoFill Destination:=.Range("L2:L99"),
    > Type:=xlFillDefault
    > .Selection.AutoFill Destination:=.Range("L2:L" & DATAcount + 1),
    > Type:=xlFillDefault
    >
    > ' .Range("L2:L99").Select
    >
    > .Range("M1").Select
    > .Selection.NumberFormat = "@" '"General"
    > .ActiveCell.FormulaR1C1 = "DateRun"
    > .Range("M2").Select
    > .ActiveCell.FormulaR1C1 = "=TODAY()"
    > .Range("M3").Select
    > .ActiveCell.FormulaR1C1 = "=TODAY()"
    > .Range("M2:M3").Select
    > .Selection.AutoFill Destination:=.Range("M2:M" & DATAcount + 1),
    > Type:=xlFillDefault
    > ' .Range("M2:M99").Select
    > ' .ActiveWindow.LargeScroll Down:=-2
    > ' .ActiveWindow.LargeScroll ToRight:=-1
    > .Range("N1").Select
    > ' .ActiveWorkbook.Save
    > .ActiveWorkbook.Close SaveChanges:=True
    >
    >
    > End With
    >
    >
    > Regards
    > Dale
    >




  3. #3
    Bob Phillips
    Guest

    Re: Use of Today() and change data type

    With oExcel
    .Range("L1").Value = "WorkOrder"
    .Range("L2").FormulaR1C1 = z
    .Range("L3").FormulaR1C1 = z
    .Range("L2").AutoFill Destination:=.Range("L2:L3"), Type:=xlFillDefault
    .Range("L2:L3").AutoFill Destination:=.Range("L2:L" & DATAcount + 1),
    Type:=xlFillDefault

    .Range("M1").Value = "DateRun"
    .Range("M2").Value = Format(Date, "dd mmm yyyy")
    .Range("M3").Value = Format(Date, "dd mmm yyyy")
    .Range("M2:M3").AutoFill Destination:=.Range("M2:M" & DATAcount + 1),
    Type:=xlFillDefault
    .ActiveWorkbook.Close SaveChanges:=True
    End With

    --
    HTH

    Bob Phillips

    "Dale" <D-Man> wrote in message
    news:[email protected]...
    > Hi all
    >
    >
    > How would I insert the date into a cell (programatically) then change its
    > data type to text.
    > Currently, when I open the file days later, of course, Excel populates the
    > cells with the current date.
    > My desired end result is subsequent openings will display the date the

    cell
    > was originally populated. (Needs to stay the same always.)
    >
    > Does anyone have a better idea how to do this?
    >
    >
    > I have the following
    >
    >
    > With oExcel
    > .Range("L1").Select
    > .Selection.NumberFormat = "General"
    > .ActiveCell.FormulaR1C1 = "WorkOrder"
    > .Range("L2").Select
    > .ActiveCell.FormulaR1C1 = z
    > .Range("L3").Select
    > .ActiveCell.FormulaR1C1 = z
    > .Range("L2").Select
    > .Selection.AutoFill Destination:=.Range("L2:L3"), Type:=xlFillDefault
    > .Range("L2:L3").Select
    > ' .Selection.AutoFill Destination:=.Range("L2:L99"),

    Type:=xlFillDefault
    > .Selection.AutoFill Destination:=.Range("L2:L" & DATAcount + 1),
    > Type:=xlFillDefault
    >
    > ' .Range("L2:L99").Select
    >
    > .Range("M1").Select
    > .Selection.NumberFormat = "@" '"General"
    > .ActiveCell.FormulaR1C1 = "DateRun"
    > .Range("M2").Select
    > .ActiveCell.FormulaR1C1 = "=TODAY()"
    > .Range("M3").Select
    > .ActiveCell.FormulaR1C1 = "=TODAY()"
    > .Range("M2:M3").Select
    > .Selection.AutoFill Destination:=.Range("M2:M" & DATAcount + 1),
    > Type:=xlFillDefault
    > ' .Range("M2:M99").Select
    > ' .ActiveWindow.LargeScroll Down:=-2
    > ' .ActiveWindow.LargeScroll ToRight:=-1
    > .Range("N1").Select
    > ' .ActiveWorkbook.Save
    > .ActiveWorkbook.Close SaveChanges:=True
    >
    >
    > End With
    >
    >
    > Regards
    > Dale
    >
    >




+ 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